-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
33 lines (23 loc) · 878 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
FROM python:3.13.1-slim@sha256:026dd417a88d0be8ed5542a05cff5979d17625151be8a1e25a994f85c87962a5 as builder
# environment
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# setup deps
COPY pyproject.toml poetry.lock ./
RUN pip install poetry && poetry install --only main --no-root --no-directory
# build project
COPY src/ ./src/
COPY README.md ./
RUN poetry build -f wheel
FROM python:3.13.1-slim@sha256:026dd417a88d0be8ed5542a05cff5979d17625151be8a1e25a994f85c87962a5
ENV APP_NAME=pydisgit
ENV HOME=/home/${APP_NAME}
ENV PATH="${HOME}/.local/bin:${PATH}"
EXPOSE 8000
RUN mkdir -p $HOME
RUN addgroup --gid 1000 --system $APP_NAME && adduser --system --uid 1000 $APP_NAME --ingroup $APP_NAME
RUN chown -R $APP_NAME:$APP_NAME $HOME
USER ${APP_NAME}
COPY --from=builder dist/ ./dist/
RUN pip install $(echo dist/*.whl)
ENTRYPOINT [ "hypercorn", "asgi:pydisgit:app" ]