-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (26 loc) · 1.02 KB
/
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
33
34
FROM python:3.13-slim AS build
WORKDIR /app
COPY ./pyproject*.toml ./
COPY ./poetry*.lock ./
RUN apt-get update \
&& apt-get upgrade -y --no-install-recommends \
&& apt-get install -y --no-install-recommends gcc python3-dev \
&& python3 -m venv /app/venv \
&& . /app/venv/bin/activate \
&& python3 -m pip install poetry \
&& poetry install
FROM python:3.13-slim AS release
RUN groupadd -g 999 python \
&& useradd -r -u 999 -g python python \
&& mkdir app \
&& chown python:python app
USER 999
WORKDIR /app
COPY --chown=python:python --from=build /app/venv ./venv
COPY --chown=python:python --from=build /app/poetry*.lock ./
COPY --chown=python:python --from=build /app/pyproject*.toml ./
COPY --chown=python:python ./scripts/start-poetry.sh .
COPY --chown=python:python ./server ./server
EXPOSE 3000
CMD [ "./start-poetry.sh", "poetry", "run", "uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "3000" ]
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD curl -f http://localhost:3000/health