-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (25 loc) · 871 Bytes
/
Copy pathDockerfile
File metadata and controls
33 lines (25 loc) · 871 Bytes
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
FROM python:3.12-slim AS base
# Set environment variables for Python
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Set work directory
WORKDIR /app
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create an unprivileged runtime user with a stable uid/gid so mounted
# volumes can be prepared for the running process.
RUN groupadd --system --gid 10001 appuser \
&& useradd --system --uid 10001 --gid appuser --create-home --home-dir /app appuser
# Copy application code
COPY . .
RUN mkdir -p /app/journal \
&& chown -R appuser:appuser /app
USER appuser
# Default command (can be overridden)
CMD ["python", "app.py"]