-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (29 loc) · 1.02 KB
/
Dockerfile
File metadata and controls
34 lines (29 loc) · 1.02 KB
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
FROM python:3.8-alpine
# Non-root user for security purposes.
# https://github.com/hexops/dockerfile#run-as-a-non-root-user
RUN addgroup -g 10001 -S nonroot \
&& adduser -u 10000 -S -G nonroot -h /home/nonroot nonroot
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
WORKDIR /code
RUN apk update \
&& apk add postgresql-dev \
&& apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev \
&& apk add --no-cache tini \
&& apk add --no-cache bind-tools
COPY requirements.txt .
RUN pip install -r requirements.txt \
&& apk del .build-deps
COPY /backend /backend
COPY /IOProject /IOProject
COPY /users /users
# Tini allows us to avoid several Docker edge cases,
# see https://github.com/krallin/tini.
ENTRYPOINT ["/sbin/tini", "--", "python"]
CMD ["manage.py", "makemigrations", "backend"]
CMD ["manage.py", "makemigrations", "users"]
CMD ["manage.py", "makemigrations"]
CMD ["manage.py", "migrate"]
# Use the non-root user to run our application
#USER nonroot
CMD ["manage.py", "runserver", "0.0.0.0:8000"]