Skip to content

Commit 0d8b981

Browse files
authored
Refactor Dockerfile for improved structure
1 parent e9e2027 commit 0d8b981

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

Dockerfile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
11
FROM python:3.11-alpine3.17 AS builder
22

3-
# Set working directory
43
WORKDIR /usr/src/app
54

6-
# Install build dependencies
75
RUN apk add --no-cache --virtual .build-deps \
86
gcc musl-dev libffi-dev
97

10-
# Install Python dependencies
118
COPY requirements.txt .
9+
1210
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
1311

14-
# Final lightweight runtime image
1512
FROM python:3.11-alpine3.17
1613

1714
WORKDIR /usr/src/app
1815

19-
# Create non-root user
2016
RUN addgroup -S app && adduser -S app -G app
2117
USER app
2218

23-
# Copy installed dependencies from builder
2419
COPY --from=builder /install /usr/local
2520

26-
# Copy app source
2721
COPY . .
2822

2923
EXPOSE 3000
3024

31-
# Use exec form to prevent shell issues
3225
CMD ["python", "app.py"]

0 commit comments

Comments
 (0)