FROM docker.io/python:3.11-alpine as python-base ENV POETRY_VERSION=1.3.2 ENV POETRY_HOME=/opt/poetry ENV POETRY_VENV=/opt/poetry-venv ENV POETRY_CACHE_DIR=/opt/.cache RUN apk add --no-cache tini libmagic FROM python-base as poetry-base RUN python3 -m venv $POETRY_VENV \ && $POETRY_VENV/bin/pip install -U pip setuptools \ && $POETRY_VENV/bin/pip install poetry==${POETRY_VERSION} FROM python-base as app COPY --from=poetry-base ${POETRY_VENV} ${POETRY_VENV} ENV PATH="${PATH}:${POETRY_VENV}/bin" WORKDIR /app COPY poetry.lock pyproject.toml ./ RUN poetry install --no-interaction --no-cache --without dev COPY . /app ENTRYPOINT ["/sbin/tini", "--"] CMD ["sh", "./entry.sh"]