This repository has been archived by the owner on Dec 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
67 lines (52 loc) · 1.51 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
56
57
58
59
60
61
62
63
64
65
66
67
# Copy node form the frontend
FROM node:21 as frontend
# Add sources into /app/
WORKDIR /app/frontend/
ADD frontend /app/frontend/
RUN yarn
RUN yarn build
# Start the nginx container
FROM python:3.8-alpine
# Install binary python dependencies
RUN apk add --no-cache \
build-base \
mailcap \
libxslt-dev \
linux-headers \
pcre-dev \
python3-dev
# Add requirements and install dependencies
ADD requirements.txt /app/
ADD requirements-prod.txt /app/
WORKDIR /app/
# Add the entrypoint and add configuration
RUN mkdir -p /var/www/static/ \
&& pip install -r requirements.txt \
&& pip install -r requirements-prod.txt
# Install Django App, configure settings and copy over djano app
ADD manage.py /app/
ADD static/ /app/static/
ADD datasets/ /app/datasets/
ADD mathdb/ /app/mathdb/
ADD docker/ /app/docker/
COPY --from=frontend /app/frontend/build/ /app/frontend/build/
ENV DJANGO_SETTINGS_MODULE "mathdb.docker_settings"
### ALL THE CONFIGURATION
# The secret key used for django
ENV DJANGO_SECRET_KEY ""
# A comma-seperated list of allowed hosts
ENV DJANGO_ALLOWED_HOSTS "localhost"
# Database settings
## Use SQLITE out of the box
ENV DJANGO_DB_ENGINE "django.db.backends.sqlite3"
ENV DJANGO_DB_NAME "/data/mathdb.db"
ENV DJANGO_DB_USER ""
ENV DJANGO_DB_PASSWORD ""
ENV DJANG_DB_HOST ""
ENV DJANGO_DB_PORT ""
# Volume and ports
VOLUME /data/
EXPOSE 80
RUN DJANGO_SECRET_KEY=build python manage.py collectstatic
ENTRYPOINT ["/app/docker/entrypoint.sh"]
CMD ["uwsgi", "--ini", "/app/docker/uwsgi.ini"]