Update image building

This commit is contained in:
2022-05-06 10:13:36 +03:00
parent 4a80243d6b
commit 7d3ae8e4aa

View File

@@ -1,26 +1,23 @@
FROM python:3.10-slim as build-image FROM ghcr.io/kurbezz/base_docker_images:3.10-poetry-buildtime as build-image
WORKDIR /root/poetry WORKDIR /root/poetry
COPY pyproject.toml poetry.lock /root/poetry/ COPY pyproject.toml poetry.lock /root/poetry/
RUN pip install poetry wheel --no-cache-dir \
&& poetry export --without-hashes > requirements.txt
ENV VENV_PATH=/opt/venv ENV VENV_PATH=/opt/venv
RUN python -m venv $VENV_PATH \ RUN poetry export --without-hashes > requirements.txt \
&& python -m venv $VENV_PATH \
&& . "${VENV_PATH}/bin/activate" \ && . "${VENV_PATH}/bin/activate" \
&& pip install -r requirements.txt --no-cache-dir && pip install -r requirements.txt --no-cache-dir
FROM python:3.10-slim as runtime-image FROM python:3.10-slim as runtime-image
COPY ./src/ /app/
ENV VENV_PATH=/opt/venv ENV VENV_PATH=/opt/venv
COPY --from=build-image $VENV_PATH $VENV_PATH
ENV PATH="$VENV_PATH/bin:$PATH" ENV PATH="$VENV_PATH/bin:$PATH"
COPY ./src/ /app/
COPY ./scripts/healthcheck.py /root/ COPY ./scripts/healthcheck.py /root/
COPY --from=build-image $VENV_PATH $VENV_PATH
EXPOSE 8080 EXPOSE 8080