-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (27 loc) · 777 Bytes
/
Dockerfile
File metadata and controls
35 lines (27 loc) · 777 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
34
35
FROM python:3.13-alpine
# Environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR /usr/app/src
# Copy requirements first (better layer caching)
COPY requirements.txt .
# Install runtime dependencies (minimal)
RUN apk add --no-cache \
libffi \
openssh-client \
openssl \
tzdata
# Install temporary build dependencies, then remove them after pip install
RUN apk add --no-cache --virtual .build-deps \
build-base \
libffi-dev \
openssl-dev \
&& pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt \
&& apk del .build-deps
# Copy the rest of the files
COPY backup.py .
# Optional: non-root user for security
RUN adduser -D appuser
USER appuser
CMD ["python", "backup.py"]