-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
42 lines (29 loc) · 836 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
ARG PYTHON_VERSION=3.10
FROM python:${PYTHON_VERSION}-slim-buster as build
ENV POETRY_VERSION=1.4.2
ENV PIP_DISABLE_PIP_VERSION_CHECK=on
ENV PIP_NO_CACHE_DIR=off
ENV PYTHONDONTWRITEBYTECODE=on
ENV PYTHONFAULTHANDLER=on
ENV PYTHONUNBUFFERED=on
RUN apt-get update
RUN apt-get install -y --no-install-recommends build-essential gcc curl
WORKDIR /app
RUN pip install "poetry==$POETRY_VERSION"
RUN poetry config virtualenvs.in-project true
COPY pyproject.toml .
COPY poetry.lock .
RUN poetry install
FROM python:${PYTHON_VERSION}-slim
WORKDIR /app
# Copy installed packages
COPY --from=build /app/.venv .venv
ENV PATH="/app/.venv/bin:$PATH"
# Copy application
COPY src .
# Build gRPC services
RUN python -m grpc_tools.protoc \
-I protobufs \
--python_out=. \
--grpc_python_out=. \
protobufs/services/**/**.proto