-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
52 lines (39 loc) · 1.33 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
FROM python:3.7.3-alpine
# create directory for the default user
RUN mkdir -p /home/stableduel
# create the default user
RUN addgroup -S stableduel && adduser -S stableduel -G stableduel
# set workdir
WORKDIR /home/stableduel/djangoapp
# enable python logging
ENV PYTHONUNBUFFERED 1
ENV LANG en_US.utf8
ARG ENV
# install dependencies
RUN pip install --upgrade pip
COPY ./requirements/*.txt ./requirements/
RUN curl https://sh.rustup.rs -sSf | sh
# install postgres client and runtime dependencies
RUN apk add --update --no-cache postgresql-client jpeg-dev zlib-dev &&\
# install individual dependencies for the build to save space
apk add --update --no-cache --virtual .tmp-build-deps \
gcc libc-dev linux-headers postgresql-dev musl-dev python3-dev \
libffi-dev openssl-dev libxml2-dev libxslt-dev python-dev
RUN apk add build-base
RUN --mount=type=cache,target=/root/.cache \
if [ "$ENV" = "dev" ]; then \
pip install -r ./requirements/local.txt; \
else \
pip install -r ./requirements/production.txt; \
fi
COPY . .
# chown all the files to the stableduel user
RUN chown -R stableduel:stableduel .
COPY start.sh /start.sh
RUN chmod +x /start.sh
COPY celery_start.sh /celery_start.sh
RUN chmod +x /celery_start.sh
RUN python manage.py collectstatic
USER stableduel
# expose 8000 and start the gunicorn server
EXPOSE 8000