-
Notifications
You must be signed in to change notification settings - Fork 247
/
Copy pathDockerfile.prod
41 lines (31 loc) · 954 Bytes
/
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
39
40
41
FROM python:3.11-alpine
WORKDIR /usr/src/app
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Copy only requirements first to leverage Docker cache
COPY requirements.txt .
# Install system dependencies and Python packages in a single layer
RUN apk update \
&& apk add --no-cache \
nano \
gobject-introspection-dev \
pango-dev \
cairo-dev \
libffi-dev \
libmagic \
libxml2-dev \
libxslt-dev \
&& python -m pip install --upgrade pip \
&& pip install -r requirements.txt
# Copy the rest of the application
COPY . .
RUN cp .env.dev.sample .env \
&& chmod +x entrypoint.prod.sh
ENV APP_HOME=/usr/src/app
# No need to create directories twice
RUN mkdir -p $APP_HOME/staticfiles \
&& mkdir -p $APP_HOME/mediafiles
RUN echo "Running from production dockerfile"
# Collect static files
RUN python manage.py collectstatic --noinput
CMD ["sh", "entrypoint.prod.sh"]