This repository has been archived by the owner on Feb 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (37 loc) · 1.76 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
FROM phusion/baseimage:latest
ENV ENKETO_SRC_DIR=/srv/src/enketo_express
################
# apt installs #
################
# Add NodeJS 8 repository
ADD https://deb.nodesource.com/gpgkey/nodesource.gpg.key /tmp/
RUN echo 'deb https://deb.nodesource.com/node_8.x xenial main' > /etc/apt/sources.list.d/nodesource.list && \
apt-key add /tmp/nodesource.gpg.key
COPY ./setup/docker/apt_requirements.txt ${ENKETO_SRC_DIR}/setup/docker/
WORKDIR ${ENKETO_SRC_DIR}/
RUN apt-get update --fix-missing && \
apt-get upgrade -y -o Dpkg::Options::="--force-confold" && \
apt-get install -y nodejs $(cat setup/docker/apt_requirements.txt) && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Non-interactive equivalent of `dpkg-reconfigure -plow unattended-upgrades` (see https://blog.sleeplessbeastie.eu/2015/01/02/how-to-perform-unattended-upgrades/).
RUN cp /usr/share/unattended-upgrades/20auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades
###############################
# Enketo Express Installation #
###############################
RUN npm install -g grunt-cli pm2
COPY ./package.json ${ENKETO_SRC_DIR}/
COPY . ${ENKETO_SRC_DIR}
ENV PATH $PATH:${KPI_SRC_DIR}/node_modules/.bin
# Persist the `secrets` directory so the encryption key remains consistent.
RUN mkdir -p ${ENKETO_SRC_DIR}/setup/docker/secrets
VOLUME ${ENKETO_SRC_DIR}/setup/docker/secrets
# Prepare for execution.
RUN ln -s "${ENKETO_SRC_DIR}/setup/docker/01_setup_enketo.bash" /etc/my_init.d/ && \
mkdir -p /etc/service/enketo_express && \
ln -s "${ENKETO_SRC_DIR}/setup/docker/run_enketo.bash" /etc/service/enketo_express/run
RUN cd /srv/src/enketo_express && \
rm -rf .git && \
npm install --production && \
grunt
COPY ./run_enketo.sh /srv/src/enketo_express/run_enketo.sh
EXPOSE 8005