-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathDockerfile
37 lines (33 loc) · 879 Bytes
/
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
###########
# BUILDER #
###########
FROM python:3.7.4 as builder
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
WORKDIR /usr/src/app
RUN apt-get update \
&& apt-get -y install python3-pip python3-dev libpq-dev postgresql postgresql-contrib nginx curl
COPY . .
COPY ./requirements.txt .
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt
###########
# FINAL #
###########
FROM python:3.7.4
RUN mkdir -p /home/sgce
RUN useradd sgce
RUN addgroup web
RUN adduser sgce web
ENV HOME=/home/sgce
ENV APP_HOME=/home/sgce/web
RUN mkdir $APP_HOME
RUN mkdir $APP_HOME/static
RUN mkdir $APP_HOME/media
WORKDIR $APP_HOME
RUN apt-get update
COPY --from=builder /usr/src/app/wheels /wheels
COPY --from=builder /usr/src/app/requirements.txt .
RUN pip install --no-cache /wheels/*
COPY . $APP_HOME
RUN chown -R sgce:web $APP_HOME
USER sgce