This repository has been archived on 2024-10-11. You can view files and clone it, but cannot push or open issues or pull requests.
tcl-filtrage/Dockerfile

43 lines
944 B
Text
Raw Permalink Normal View History

2021-11-09 13:12:53 +01:00
## Build venv
2022-03-25 19:24:01 +01:00
FROM python:3.10.4-bullseye AS venv
2021-11-09 13:12:53 +01:00
# https://python-poetry.org/docs/#installation
2022-03-25 19:18:15 +01:00
ENV POETRY_VERSION=1.1.13
2022-03-25 19:27:41 +01:00
RUN curl -sSL https://install.python-poetry.org | python3 -
2021-11-09 13:12:53 +01:00
ENV PATH /root/.local/bin:$PATH
ARG POETRY_OPTIONS
WORKDIR /app
COPY pyproject.toml poetry.lock ./
RUN python -m venv --copies /app/venv \
&& . /app/venv/bin/activate \
&& poetry install $POETRY_OPTIONS
## Get git versions
FROM alpine/git:v2.26.2 AS git
ADD . /app
WORKDIR /app
RUN git rev-parse HEAD | tee /version
## Beginning of runtime image
2022-03-25 19:24:01 +01:00
FROM python:3.10.4-slim-bullseye as final
2021-11-09 13:12:53 +01:00
2022-03-25 19:25:12 +01:00
ENV TZ "Europe/Paris"
2021-11-09 13:12:53 +01:00
COPY --from=venv /app/venv /app/venv/
ENV PATH /app/venv/bin:$PATH
WORKDIR /app
COPY main.py pyproject.toml ./
COPY --from=git /version /app/.version
2021-12-09 08:03:54 +01:00
HEALTHCHECK --start-period=30s CMD python -c "import requests; requests.get('http://localhost:8000', timeout=2).raise_for_status()"
2021-11-09 13:12:53 +01:00
2021-11-14 11:54:04 +01:00
CMD ["uvicorn", "--host=0.0.0.0", "main:app"]