-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.etl
More file actions
34 lines (23 loc) · 862 Bytes
/
Dockerfile.etl
File metadata and controls
34 lines (23 loc) · 862 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
# Stage 1: Build the dependencies
FROM python:3.13.3 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 wheel --no-cache-dir --wheel-dir /app/wheels -r requirements.txt
# Stage 2: Create the final production image
FROM python:3.13.3
# Create a non-root user for security
RUN useradd --create-home appuser
WORKDIR /home/appuser/app
# Copy installed dependencies from the builder stage
COPY --from=builder /app/wheels /wheels
COPY --from=builder /app/requirements.txt .
# Install the Python dependencies from local wheels
RUN pip install --no-cache /wheels/*
# Copy the application source code
COPY src/ .
# Change ownership of the app directory to the non-root user
RUN chown -R appuser:appuser /home/appuser
USER appuser