-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.prod
38 lines (26 loc) · 1.01 KB
/
Dockerfile.prod
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
36
37
38
# Use a specific Python version for consistency
FROM python:3.10-alpine3.19 AS builder
# Install system dependencies
RUN apk add --no-cache --virtual .build-deps gcc musl-dev libffi-dev \
&& apk add --no-cache postgresql-dev
# Set the working directory
WORKDIR /app
# Copy the requirements file and install dependencies
COPY ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
# Create the final image
FROM python:3.10-alpine3.19
# Copy only the necessary files from the builder stage
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /usr/lib /usr/lib
# Copy the application files
COPY ./app /app
COPY ./gunicorn_config.py /app/gunicorn_config.py
COPY ./entrypoint.sh /app/entrypoint.sh
# Install runtime dependencies
# RUN apk add --no-cache postgresql-dev
# Expose the port the app runs on
EXPOSE 8000
WORKDIR /app
ENTRYPOINT ["./entrypoint.sh"]