-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (28 loc) · 1.13 KB
/
Dockerfile
File metadata and controls
40 lines (28 loc) · 1.13 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
# ============================================================
# Stage 1: Install Python dependencies
# ============================================================
FROM python:3.14-slim AS builder
WORKDIR /build
COPY requirements.txt pyproject.toml ./
COPY src/ ./src/
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt && \
pip install --no-cache-dir --prefix=/install --no-deps .
# ============================================================
# Stage 2: Minimal runtime image
# ============================================================
FROM python:3.14-slim
LABEL maintainer="amartingarcia, ialejandro"
# Non-root user
RUN groupadd -r prgen && useradd -r -g prgen -d /app -s /sbin/nologin prgen
# Copy installed packages from builder
COPY --from=builder /install /usr/local
# Copy application source
WORKDIR /app
COPY src/ ./src/
RUN chown -R prgen:prgen /app
ENV PYTHONPATH=/app/src
USER prgen
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/healthz')" || exit 1
EXPOSE 8080
ENTRYPOINT ["python", "-m", "pr_generator"]