This repository has been archived by the owner on Nov 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new Dockerfile from Dockerfiles repo
- Loading branch information
1 parent
b9b82f1
commit 7ef572a
Showing
1 changed file
with
60 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,89 @@ | ||
# Dockerfile for the PDC's Visualizer service | ||
# | ||
# Base image | ||
# | ||
# Visualizer for PDC-collected aggregate data. Link to Auth and HAPI. | ||
# | ||
# Example: | ||
# sudo docker pull pdcbc/viz | ||
# sudo docker run -d --name=viz -h viz --restart=always \ | ||
# --link auth:auth \ | ||
# --link hapi:hapi \ | ||
# -p 443:3004 \ | ||
# -p 80:3008 \ | ||
# pdcbc/viz | ||
# | ||
# Linked containers | ||
# - Auth: --link auth:auth | ||
# - HAPI: --link hapi:hapi | ||
# | ||
# External ports | ||
# - https: -p <hostPort(443)>:3004 | ||
# - http: -p <hostPort(80)>:3008 | ||
# | ||
# Modify default settings | ||
# - Node secret: -e NODE_SECRET=<string> | ||
# - Reject non-CA -e REJECT_NONCA_CERTS=<0/1> | ||
# certificates?: | ||
# | ||
# Releases | ||
# - https://github.com/PDCbc/viz/releases | ||
# | ||
# | ||
FROM phusion/passenger-nodejs | ||
MAINTAINER [email protected] | ||
ENV RELEASE 0.1.7 | ||
|
||
|
||
# Update system, install Python 2.7 | ||
# Packages | ||
# | ||
ENV DEBIAN_FRONTEND noninteractive | ||
RUN echo 'Dpkg::Options{ "--force-confdef"; "--force-confold" }' \ | ||
>> /etc/apt/apt.conf.d/local | ||
RUN apt-get update; \ | ||
apt-get upgrade -y; \ | ||
apt-get install -y python2.7 | ||
apt-get install -y \ | ||
python2.7 \ | ||
git; \ | ||
apt-get clean; \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
|
||
# Prepare /app/ folder | ||
# | ||
WORKDIR /app/ | ||
RUN git clone https://github.com/pdcbc/viz.git -b ${RELEASE} .; \ | ||
npm config set python /usr/bin/python2.7; \ | ||
npm install; \ | ||
chown -R app:app /app/ | ||
|
||
|
||
# Create startup script and make it executable | ||
# | ||
RUN mkdir -p /etc/service/app/ | ||
RUN ( \ | ||
RUN mkdir -p /etc/service/app/; \ | ||
( \ | ||
echo "#!/bin/bash"; \ | ||
echo "#"; \ | ||
echo "set -e -o nounset"; \ | ||
echo ""; \ | ||
echo ""; \ | ||
echo "# Environment variables"; \ | ||
echo "#"; \ | ||
echo "export PORT=\${PORT_VIZ}"; \ | ||
echo "export AUTH_MAIN_URL=https://auth:\${PORT_AUTH_M}"; \ | ||
echo "export AUTH_CONTROL_URL=https://auth:\${PORT_AUTH_C}"; \ | ||
echo "export CALLBACK_URL=https://auth:\${PORT_AUTH_C}/auth/callback"; \ | ||
echo "export HUBAPI_URL=\${URL_HAPI}"; \ | ||
echo "export SECRET=\${NODE_SECRET}"; \ | ||
echo "export DACS=\${DACS_STOREDIR}"; \ | ||
echo "export PORT=\${PORT_VIZ:-3004}"; \ | ||
echo "export PORT_VIZ_HTTP=\${PORT_VIZ:-3008}"; \ | ||
echo "export AUTH_MAIN_URL=https://auth:\${PORT_AUTH_M:-3005}"; \ | ||
echo "export AUTH_CONTROL_URL=https://auth:\${PORT_AUTH_C:-3006}"; \ | ||
echo "export CALLBACK_URL=https://auth:\${PORT_AUTH_C:-3006}/auth/callback"; \ | ||
echo "export HUBAPI_URL=https://hapi:\${PORT_HAPI:-3003}"; \ | ||
echo "#"; \ | ||
echo "export MODE=PROD"; \ | ||
echo "export DACS=/etc/dacs"; \ | ||
echo "export NODE_TLS_REJECT_UNAUTHORIZED=\${REJECT_NONCA_CERTS:-0}"; \ | ||
echo "export SECRET=\${NODE_SECRET:-notVerySecret}"; \ | ||
echo ""; \ | ||
echo ""; \ | ||
echo "# Start service"; \ | ||
echo "#"; \ | ||
echo "cd /app/"; \ | ||
echo "/sbin/setuser app npm start"; \ | ||
) \ | ||
>> /etc/service/app/run | ||
RUN chmod +x /etc/service/app/run | ||
|
||
|
||
# Prepare /app/ folder | ||
# | ||
WORKDIR /app/ | ||
COPY . . | ||
RUN npm config set python /usr/bin/python2.7 | ||
RUN npm install | ||
RUN chown -R app:app /app/ | ||
>> /etc/service/app/run; \ | ||
chmod +x /etc/service/app/run | ||
|
||
|
||
# Run Command | ||
|