forked from SAIC-iSmart-API/saic-python-mqtt-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (22 loc) · 872 Bytes
/
Dockerfile
File metadata and controls
32 lines (22 loc) · 872 Bytes
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
ARG POETRY_VERSION=2.1.3
ARG PYTHON_VERSION=3.12
FROM nanomad/poetry:${POETRY_VERSION}-python-${PYTHON_VERSION} AS builder
WORKDIR /usr/src/app
# --- Reproduce the environment ---
# You can comment the following two lines if you prefer to manually install
# the dependencies from inside the container.
COPY pyproject.toml poetry.lock /usr/src/app/
# Install the dependencies and clear the cache afterwards.
# This may save some MBs.
RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR
# Now let's build the runtime image from the builder.
# We'll just copy the env and the PATH reference.
FROM python:${PYTHON_VERSION}-slim AS runtime
WORKDIR /usr/src/app
ENV VIRTUAL_ENV=/usr/src/app/.venv
ENV PATH="/usr/src/app/.venv/bin:$PATH"
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY src/ .
COPY examples/ .
USER 185:185
CMD [ "python", "./main.py"]