forked from CarletonSLAM/ieee-office-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
38 lines (29 loc) · 948 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
38
# pull official base image
FROM python:3.5-alpine
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install psycopg2
RUN apk update
RUN apk add --virtual build-deps gcc python3-dev musl-dev
RUN apk add postgresql-dev
RUN pip install psycopg2 pipenv
RUN apk del build-deps
# copy project
COPY backend /app
# set work directory
WORKDIR /app
# install dependencies
RUN pipenv lock --requirements > requirements.txt
RUN pip install -r requirements.txt
ENV DJANGO_SETTINGS_MODULE dashyserver.settings.prod
# add and run as non-root user
RUN adduser -D webuser
RUN mkdir /app/static
RUN chown webuser:webuser /app/static
RUN chown webuser:webuser /app/api/migrations
VOLUME /app/static
VOLUME /app/api/migrations
USER webuser
# run gunicorn
CMD python manage.py makemigrations && python manage.py migrate && python manage.py collectstatic --noinput && gunicorn dashyserver.wsgi --log-file=- --bind 0.0.0.0:$PORT