Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
salko-ua authored Jan 23, 2025
1 parent 6836b09 commit 6932575
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
FROM python:3.12 AS poetry
FROM python:3.12-slim AS poetry

ENV PATH "/root/.local/bin:${PATH}"
ENV PYTHONUNBUFFERED 1
ENV POETRY_VIRTUALENVS_IN_PROJECT 1

WORKDIR /root
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update && \
apt-get install curl -y --no-install-recommends && \
curl -sSL https://install.python-poetry.org | python -
curl -sSL https://install.python-poetry.org | python - && \
poetry self add poetry-plugin-export
COPY poetry.lock pyproject.toml ./
RUN poetry install --only main,docker --no-root
RUN poetry export --no-interaction -o requirements.txt --without-hashes --only main,docker


FROM python:3.12-slim AS base

ENV PYTHONPATH "/app"


WORKDIR /app

RUN groupadd -g 5000 container && useradd -d /app -m -g container -u 5000 container

COPY --from=poetry /root/.venv ./.venv
COPY . .
COPY --from=poetry /root/requirements.txt ./
RUN pip --no-cache-dir install -U pip && \
pip --no-cache-dir install -r requirements.txt
COPY src/ src/

FROM base AS final

RUN chown -R 5000:5000 /app
USER container

CMD [".venv/bin/dumb-init", ".venv/bin/python", "main.py"]
CMD ["dumb-init", "python", "-m", "src"]

0 comments on commit 6932575

Please sign in to comment.