-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerFile
More file actions
32 lines (23 loc) · 1.04 KB
/
Copy pathDockerFile
File metadata and controls
32 lines (23 loc) · 1.04 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
# ==============================================================================
# STAGE 1: Compilation Sandbox Environment
# ==============================================================================
FROM python:3.14-slim AS builder
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# ==============================================================================
# STAGE 2: Minimum Footprint Production Runtime Engine
# ==============================================================================
FROM python:3.14-slim AS runner
WORKDIR /app
# Enforce strict Least Privilege Principles by using a low-privilege runtime account
RUN useradd -u 8888 apprunner && chown -R apprunner:apprunner /app
USER apprunner
COPY --from=builder /root/.local /home/apprunner/.local
COPY --chown=apprunner:apprunner . .
ENV PATH=/home/apprunner/.local/bin:$PATH
EXPOSE 8888
CMD ["python", "server.py"]