-
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
5 changed files
with
630 additions
and
17 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,25 +1,42 @@ | ||
FROM python:3.12-slim-bookworm | ||
FROM python:3.12-slim-bookworm AS base | ||
|
||
ENV PYTHONUNBUFFERED=1 \ | ||
ADDRESS=0.0.0.0 \ | ||
PORT=7979 \ | ||
DEBUG=false | ||
PYTHONFAULTHANDLER=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONHASHSEED=random | ||
|
||
WORKDIR /src | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
git \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
FROM base AS builder | ||
|
||
ENV PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
POETRY_NO_INTERACTION=1 \ | ||
POETRY_VERSION=1.8 | ||
|
||
RUN pip install "poetry==$POETRY_VERSION" | ||
|
||
COPY poetry.lock pyproject.toml ./ | ||
|
||
COPY requirements.txt . | ||
RUN poetry config virtualenvs.in-project true && \ | ||
poetry install --only=main --no-root | ||
|
||
RUN pip install --no-cache-dir -r requirements.txt | ||
FROM base AS final | ||
|
||
RUN adduser -u 1000 python | ||
|
||
USER python | ||
|
||
ENV ADDRESS=0.0.0.0 \ | ||
PORT=7979 \ | ||
DEBUG=false | ||
|
||
COPY --from=builder /src/.venv ./.venv | ||
COPY constants/ ./constants/ | ||
COPY app/ ./app/ | ||
COPY main.py . | ||
|
||
EXPOSE 7979 | ||
|
||
ENTRYPOINT ["/usr/local/bin/python", "./main.py"] | ||
ENTRYPOINT ["/src/.venv/bin/python3", "./main.py"] |
Oops, something went wrong.