-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (31 loc) · 1.43 KB
/
Dockerfile
File metadata and controls
45 lines (31 loc) · 1.43 KB
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
35
36
37
38
39
40
41
42
43
44
45
FROM python:3.13-alpine AS builder
RUN apk update && apk upgrade --no-cache libcrypto3 libssl3 zlib musl musl-utils
RUN apk add --no-cache gcc alpine-sdk linux-headers musl-dev git
RUN pip install poetry==2.3.2
WORKDIR /app
COPY pyproject.toml poetry.lock poetry.toml README.md ./
RUN poetry install --no-interaction --no-ansi --no-cache --no-root \
--no-directory --only main
COPY ./src/quickapp /app/quickapp
COPY ./config/predefined /app/predefined
RUN poetry install --no-interaction --no-ansi --no-cache --only main
FROM python:3.13-alpine AS runtime
RUN apk update && apk upgrade --no-cache libcrypto3 libssl3 libexpat zlib musl musl-utils
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYDANTIC_V2=True
# Copy the sources and virtual env. No poetry.
RUN adduser -u 1001 --disabled-password --gecos "" appuser
COPY --chown=appuser --from=builder /app .
RUN echo '#!/bin/sh' > /docker_entrypoint.sh && \
echo 'set -e' >> /docker_entrypoint.sh && \
echo '. ./.venv/bin/activate' >> /docker_entrypoint.sh && \
echo 'exec "$@"' >> /docker_entrypoint.sh && \
chmod +x /docker_entrypoint.sh
EXPOSE 5000
USER appuser
ENTRYPOINT ["/docker_entrypoint.sh"]
HEALTHCHECK --interval=10s --timeout=5s --start-period=30s --retries=6 \
CMD wget --no-verbose --tries=1 --spider http://localhost:5000/health || exit 1
CMD ["uvicorn", "quickapp.app:app", "--host", "0.0.0.0", "--port", "5000", "--lifespan", "on"]