forked from Rastaiha/Main-Website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
55 lines (39 loc) · 1.4 KB
/
dockerfile
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
52
53
54
55
# pull official base image
FROM python:3.8.2-alpine
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN apk add --no-cache --virtual .build-deps gcc musl-dev
# install python-dev
RUN apk update \
&& apk add --virtual .build-deps gcc libc-dev libxslt-dev \
&& apk add libffi-dev openssl-dev linux-headers \
&& apk add --no-cache libxslt \
&& pip install lxml==4.5.0
# install psycopg2
RUN apk update \
&& apk add --virtual build-deps gcc python3-dev musl-dev \
&& apk add postgresql-dev \
&& pip install psycopg2 \
&& pip install --upgrade incremental
# install zlib for pillow
RUN apk add --no-cache jpeg-dev zlib-dev build-base
# install dependencies
RUN pip install --upgrade pip setuptools
# copy requirements
COPY requirements.txt /usr/src/requirements.txt
RUN pip install -r /usr/src/requirements.txt
# copy entrypoint-prod.sh
COPY ./entrypoint.prod.sh /usr/src/app/entrypoint.prod.sh
# copy project
COPY . /usr/src/app/
RUN adduser -D website
RUN mkdir -p /usr/src/app/logging && chown -R website /usr/src/app/logging \
&& mkdir -p /usr/src/app/staticfiles && chown -R website /usr/src/app/staticfiles \
&& mkdir -p /usr/src/app/media && chown -R website /usr/src/app/media
RUN chown -R website /usr/src/app/
USER website
# run entrypoint.prod.sh
ENTRYPOINT ["/usr/src/app/entrypoint.prod.sh"]