-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |