Skip to content
This repository was archived by the owner on Nov 22, 2018. It is now read-only.

Commit 7ef572a

Browse files
committed
Added new Dockerfile from Dockerfiles repo
1 parent b9b82f1 commit 7ef572a

File tree

1 file changed

+60
-27
lines changed

1 file changed

+60
-27
lines changed

Dockerfile

Lines changed: 60 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,89 @@
11
# Dockerfile for the PDC's Visualizer service
22
#
3-
# Base image
3+
#
4+
# Visualizer for PDC-collected aggregate data. Link to Auth and HAPI.
5+
#
6+
# Example:
7+
# sudo docker pull pdcbc/viz
8+
# sudo docker run -d --name=viz -h viz --restart=always \
9+
# --link auth:auth \
10+
# --link hapi:hapi \
11+
# -p 443:3004 \
12+
# -p 80:3008 \
13+
# pdcbc/viz
14+
#
15+
# Linked containers
16+
# - Auth: --link auth:auth
17+
# - HAPI: --link hapi:hapi
18+
#
19+
# External ports
20+
# - https: -p <hostPort(443)>:3004
21+
# - http: -p <hostPort(80)>:3008
22+
#
23+
# Modify default settings
24+
# - Node secret: -e NODE_SECRET=<string>
25+
# - Reject non-CA -e REJECT_NONCA_CERTS=<0/1>
26+
# certificates?:
27+
#
28+
# Releases
29+
# - https://github.com/PDCbc/viz/releases
30+
#
431
#
532
FROM phusion/passenger-nodejs
33+
MAINTAINER derek.roberts@gmail.com
34+
ENV RELEASE 0.1.7
635

736

8-
# Update system, install Python 2.7
37+
# Packages
938
#
10-
ENV DEBIAN_FRONTEND noninteractive
11-
RUN echo 'Dpkg::Options{ "--force-confdef"; "--force-confold" }' \
12-
>> /etc/apt/apt.conf.d/local
1339
RUN apt-get update; \
14-
apt-get upgrade -y; \
15-
apt-get install -y python2.7
40+
apt-get install -y \
41+
python2.7 \
42+
git; \
43+
apt-get clean; \
44+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
45+
46+
47+
# Prepare /app/ folder
48+
#
49+
WORKDIR /app/
50+
RUN git clone https://github.com/pdcbc/viz.git -b ${RELEASE} .; \
51+
npm config set python /usr/bin/python2.7; \
52+
npm install; \
53+
chown -R app:app /app/
1654

1755

1856
# Create startup script and make it executable
1957
#
20-
RUN mkdir -p /etc/service/app/
21-
RUN ( \
58+
RUN mkdir -p /etc/service/app/; \
59+
( \
2260
echo "#!/bin/bash"; \
2361
echo "#"; \
2462
echo "set -e -o nounset"; \
2563
echo ""; \
2664
echo ""; \
2765
echo "# Environment variables"; \
2866
echo "#"; \
29-
echo "export PORT=\${PORT_VIZ}"; \
30-
echo "export AUTH_MAIN_URL=https://auth:\${PORT_AUTH_M}"; \
31-
echo "export AUTH_CONTROL_URL=https://auth:\${PORT_AUTH_C}"; \
32-
echo "export CALLBACK_URL=https://auth:\${PORT_AUTH_C}/auth/callback"; \
33-
echo "export HUBAPI_URL=\${URL_HAPI}"; \
34-
echo "export SECRET=\${NODE_SECRET}"; \
35-
echo "export DACS=\${DACS_STOREDIR}"; \
67+
echo "export PORT=\${PORT_VIZ:-3004}"; \
68+
echo "export PORT_VIZ_HTTP=\${PORT_VIZ:-3008}"; \
69+
echo "export AUTH_MAIN_URL=https://auth:\${PORT_AUTH_M:-3005}"; \
70+
echo "export AUTH_CONTROL_URL=https://auth:\${PORT_AUTH_C:-3006}"; \
71+
echo "export CALLBACK_URL=https://auth:\${PORT_AUTH_C:-3006}/auth/callback"; \
72+
echo "export HUBAPI_URL=https://hapi:\${PORT_HAPI:-3003}"; \
73+
echo "#"; \
74+
echo "export MODE=PROD"; \
75+
echo "export DACS=/etc/dacs"; \
76+
echo "export NODE_TLS_REJECT_UNAUTHORIZED=\${REJECT_NONCA_CERTS:-0}"; \
77+
echo "export SECRET=\${NODE_SECRET:-notVerySecret}"; \
3678
echo ""; \
3779
echo ""; \
3880
echo "# Start service"; \
3981
echo "#"; \
4082
echo "cd /app/"; \
4183
echo "/sbin/setuser app npm start"; \
4284
) \
43-
>> /etc/service/app/run
44-
RUN chmod +x /etc/service/app/run
45-
46-
47-
# Prepare /app/ folder
48-
#
49-
WORKDIR /app/
50-
COPY . .
51-
RUN npm config set python /usr/bin/python2.7
52-
RUN npm install
53-
RUN chown -R app:app /app/
85+
>> /etc/service/app/run; \
86+
chmod +x /etc/service/app/run
5487

5588

5689
# Run Command

0 commit comments

Comments
 (0)