forked from usnistgov/NEMO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.splash_pad
45 lines (35 loc) · 1.41 KB
/
Dockerfile.splash_pad
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
FROM python:3.8
RUN apt-get update && apt-get upgrade -y && apt-get install -y systemctl rsync
COPY . /nemo/
RUN pip install /nemo/
RUN rm --recursive --force /nemo
RUN mkdir /nemo
RUN mkdir /nemo/media
RUN mkdir /nemo/systemd
WORKDIR /nemo
COPY resources/icons/ /nemo/media
COPY resources/people/ /nemo/media/
COPY resources/sounds/ /nemo/media/
COPY resources/images/ /nemo/media/
COPY resources/emails/ /nemo/media/
COPY resources/systemd/ /nemo/systemd/
COPY resources/splash_pad_rates.json /nemo/media/rates.json
COPY resources/splash_pad_settings.py /nemo/
COPY resources/fixtures/splash_pad.json /nemo/
ENV DJANGO_SETTINGS_MODULE "splash_pad_settings"
ENV PYTHONPATH "/nemo/"
RUN django-admin makemigrations NEMO
RUN django-admin migrate
RUN django-admin loaddata splash_pad.json
# Install systemd services after replacing docker command
WORKDIR /nemo/systemd
# Replace docker command by direct django-admin command
RUN find . -type f -name '*.service' | xargs sed -i "s/\/usr\/bin\/docker exec nemo django-admin/\/usr\/local\/bin\/django-admin/g"
RUN rsync * /etc/systemd/system
RUN systemctl daemon-reload
RUN (cd /nemo/systemd && ls *.timer) | xargs -t -I % systemctl enable %
WORKDIR /nemo
ENV REMOTE_USER "captain"
EXPOSE 8000/tcp
# We have to start systemd jobs manually here unfortunately
CMD (cd /nemo/systemd && ls *.timer) | sed -e 's/\.timer$//' | xargs -t -I % systemctl start % ; django-admin runserver 0.0.0.0:8000