-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.prod
51 lines (37 loc) · 1.21 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
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM python:3.8-slim-buster as image_base
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
RUN apt-get update \
# dependencies for building Python packages
&& apt-get install -y build-essential \
# psycopg2 dependencies
&& apt-get install -y libpq-dev \
# Translations dependencies
&& apt-get install -y gettext bash curl jq \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade pip
COPY ./requirements /requirements
RUN pip install --no-cache-dir -r /requirements/common.txt
COPY compose/post-build /post-build
RUN sed -i 's/\r$//g' /post-build
RUN chmod +x /post-build
COPY ./requirements /requirements
RUN pip install --no-cache-dir -r /requirements/common.txt
COPY compose/post-build /post-build
RUN sed -i 's/\r//' /post-build
RUN chmod +x /post-build
EXPOSE 8000
WORKDIR /app
#
# P R O D U C T I O N
#
FROM image_base as production
RUN pip install --no-cache-dir -r /requirements/production.txt
COPY compose/start-prod /start
RUN sed -i 's/\r//' /start
RUN chmod +x /start
COPY . /app
HEALTHCHECK CMD curl -sSf http://localhost:8000/ || exit 1
CMD gunicorn -c gunicorn.ini config.wsgi