Commit c1dffefd authored by Dave Lane's avatar Dave Lane

working CouchDB container, with admin credentials and option of a proxy secret

parent 61e32383
......@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations under
# the License.
FROM debian:jessie
FROM ubuntu:trusty
MAINTAINER Dave Lane dave@oerfoundation.org
# (adapted from work by Clemens Stolle klaemo@apache.org)
......@@ -21,27 +21,37 @@ MAINTAINER Dave Lane dave@oerfoundation.org
# The aim: to make a manageable fully functional dev environment which
# fosters remote API-ification for registering new blog users,
# updating details for session validation, and possibly integrating Mautic...
#
# Defines
ENV WESVR git@bitbucket.org:wikieducator/wenotes-server.git
ENV WETOOL git@bitbucket.org:wikieducator/wenotes-tools.git
ENV WEDIR /opt/wenotes
ENV APT_SERVER http://ucmirror.canterbury.ac.nz/ubuntu
ENV APT_FILE sources.list
ENV UBUNTU_NAME trusty
# subdue the "Dialog" errors...
ENV DEBIAN_FRONTEND noninteractive
#
# Add CouchDB user account
RUN groupadd -r couchdb && useradd -d /opt/couchdb -g couchdb couchdb
#
# add local mirror to reduce build time :)
RUN echo "deb $APT_SERVER ${UBUNTU_NAME} main universe" > /etc/apt/${APT_FILE}
RUN echo "deb $APT_SERVER ${UBUNTU_NAME}-updates main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb $APT_SERVER ${UBUNTU_NAME}-security main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME} main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME}-updates main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME}-security main universe" >> /etc/apt/${APT_FILE}
# do one update and start installing...
RUN apt-get update -y && apt-get install -y --no-install-recommends \
apt-transport-https \
apt-utils \
ca-certificates \
curl \
git \
haproxy \
erlang-nox \
erlang-reltool \
libicu52 \
libmozjs185-1.0 \
openssl \
&& rm -rf /var/lib/apt/lists/*
openssl
# && rm -rf /var/lib/apt/lists/*
# grab gosu for easy step-down from root and tini for signal handling
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
......@@ -59,23 +69,25 @@ RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364
ENV COUCHDB_VERSION 2.0.0
# install Node.JS repos and do another update...
RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
&& echo 'deb https://deb.nodesource.com/node_4.x trusty main' > /etc/apt/sources.list.d/nodesource.list \
&& echo 'deb-src https://deb.nodesource.com/node_4.x trusty main' >> /etc/apt/sources.list.d/nodesource.list \
&& apt-get update -y -qq
# Download dev dependencies
RUN apt-get update -y -qq && apt-get install -y --no-install-recommends \
apt-transport-https \
RUN apt-get install -y --no-install-recommends \
build-essential \
erlang-dev \
libcurl4-openssl-dev \
libicu-dev \
libmozjs185-dev \
&& curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
&& echo 'deb https://deb.nodesource.com/node_4.x jessie main' > /etc/apt/sources.list.d/nodesource.list \
&& echo 'deb-src https://deb.nodesource.com/node_4.x jessie main' >> /etc/apt/sources.list.d/nodesource.list \
&& apt-get update -y -qq \
# install nodejs stack...
&& apt-get install -y nodejs \
&& npm install -g grunt-cli \
&& npm install -g grunt-cli
# set up pm2
RUN npm install -g pm2
# Acquire CouchDB source code
&& cd /usr/src && mkdir couchdb \
RUN cd /usr/src && mkdir couchdb \
&& curl -fSL https://dist.apache.org/repos/dist/release/couchdb/source/2.0.0/apache-couchdb-$COUCHDB_VERSION.tar.gz -o couchdb.tar.gz \
&& tar -xzf couchdb.tar.gz -C couchdb --strip-components=1 \
&& cd couchdb \
......@@ -84,77 +96,55 @@ RUN apt-get update -y -qq && apt-get install -y --no-install-recommends \
&& make release \
&& mv /usr/src/couchdb/rel/couchdb /opt/ \
# Cleanup build detritus
&& apt-get purge -y \
binutils \
build-essential \
cpp \
erlang-dev \
git \
libicu-dev \
make \
nodejs \
perl \
# && apt-get purge -y \
# binutils \
# build-essential \
# cpp \
# erlang-dev \
# libicu-dev \
# make \
# perl \
&& apt-get autoremove -y && apt-get clean \
&& apt-get install -y libicu52 --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* /usr/lib/node_modules /usr/src/couchdb*
# && rm -rf /var/lib/apt/lists/* /usr/lib/node_modules /usr/src/couchdb*
&& rm -rf /usr/src/couchdb*
# Add configuration
COPY local.ini /opt/couchdb/etc/
COPY vm.args /opt/couchdb/etc/
COPY ./docker-entrypoint.sh /
# Sprinkle couchdb configuration to the right places...
COPY couchdb/local.ini /opt/couchdb/etc/
COPY couchdb/vm.args /opt/couchdb/etc/
COPY couchdb/couchdb-init.sh /
# Setup directories and permissions
RUN chmod +x /docker-entrypoint.sh \
RUN chmod +x /couchdb-init.sh \
&& mkdir /opt/couchdb/data /opt/couchdb/etc/local.d /opt/couchdb/etc/default.d \
&& chown -R couchdb:couchdb /opt/couchdb/
WORKDIR /opt/couchdb
EXPOSE 5984 4369 9100
VOLUME ["/opt/couchdb/data"]
#
# get the WENotes repos
WORKDIR /opt/wenotes
# get the repo
RUN git clone $WESVR ${WEDIR}/server
# set up options.json
# get the repo
RUN git clone $WETOOLS ${WEDIR}/tools
# set up options.json
# set up pm2
RUN npm install pm2 -g
VOLUME ["/opt/wenotes"]
# Set up the language variables
ENV LANG en_NZ.UTF-8
ENV LANGUAGE en_NZ.UTF-8
ENV LC_ALL en_NZ.UTF-8
# Compile the language spec
RUN locale-gen $LANG
#
# Some final exports to get the environment right...
RUN echo "export VISIBLE=now" >> /etc/profile \
&& echo "export TERM=xterm" >> /etc/bash.bashrc
# set up the various scripts we need to run on the container
# after it's built...
COPY ./conf /root/conf/
# Prepare the preinstall hook
RUN chmod u+x /root/conf/pre-install.sh
Prepare the main install script
RUN chmod u+x /root/conf/start.sh && chmod u+x /root/conf/run.sh
# Set up the language variables
ENV LANG en_NZ.UTF-8
ENV LANGUAGE en_NZ.UTF-8
ENV LC_ALL en_NZ.UTF-8
# Compile the language spec
RUN locale-gen $LANG
#
# Some final exports to get the environment right...
RUN echo "export VISIBLE=now" >> /etc/profile \
&& echo "export TERM=xterm" >> /etc/bash.bashrc
#Prepare the main install script
RUN chmod u+x /root/conf/*.sh
# expose relevant ports
EXPOSE 80 5984 4369 9100
VOLUME ["/opt/couchdb/data", "/opt/wenotes"]
# First, say we're doing it
RUN echo "running run.sh - /root/conf/run.sh"
# Actually do it.
CMD ["/root/conf/run.sh"]
RUN /root/conf/run.sh
# Say we're finished
RUN echo "finished run.sh"
#ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
#CMD ["/opt/couchdb/bin/couchdb"]
# Launch couchdb, couchwatch.js, twitters.js, wenotestochat.js and irc.js
CMD ["/bin/bash"]
......@@ -2,7 +2,23 @@ From https://github.com/klaemo/docker-couchdb/tree/master/2.0.0
See https://github.com/klaemo/docker-couchdb for documentation
==Starting CouchDB==
docker run -d --name couchdb -v /home/dave/Docker/couchdb/data:/opt/couchdb/data oeru/couchdb
--Old--
Built via: docker build -t oeru/couchdb .
Launched via: docker run --name couchdb -v /home/dave/Docker/wenotes/data:/opt/couchdb/data -d oeru/couchdb
==Building and Running Containers==
===CouchDB===
Build: docker build -t oeru/couchdb docker-couchdb
Launch (replacing [password]):
docker run --name couchdb -v /home/dave/Docker/wenotes/data:/opt/couchdb/data \
-e COUCHDB_USER=admin -e COUCHDB_PASSWORD=[password] -d oeru/couchdb
===Faye===
Build: docker build -t oeru/faye docker-faye
Launch: docker run --name faye -v /home/dave/Docker/wenotes/faye:/opt/wenotes/server -d oeru/faye
{
"server": {
"ip": "localhost",
"port": 80,
"secureport": "",
"privkey": "",
"fullchain": ""
},
"log": {
"couchwatch": {
"level": 7,
"file": "/tmp/couchwatch.log"
},
"twitters": {
"level": 7,
"file": "/tmp/twitters.log"
},
"server": {
"level": 7,
"file": "/tmp/wenotes-server.log"
}
}
}
#!/bin/sh
#!/bin/bash
# Bash hasn't been initialized yet so add path to composer manually.
#export PATH="$HOME/.composer/vendor/bin:$PATH"
echo "in run.sh!"
# Run start script.
echo "*****Running run.sh"
CONF=/root/conf
COUCH=/root
WENOTES=/opt/wenotes
CWD=`pwd`
# Defines
WESERVER=https://kiwilightweight@bitbucket.org/wikieducator/wenotes-server.git
WETOOLS=https://kiwilightweight@bitbucket.org/wikieducator/wenotes-tools.git
GIT=`which git`
NPM=`which npm`
PM2=`which pm2`
CP=`which cp`
echo "CWD=$CWD, GIT=$GIT"
# Run before-run scripts added by another containers.
if [[ -d /root/conf/before-start ]] ; then
FILES=/root/conf/before-start/*
if [[ -d $CONF/before-start ]] ; then
FILES=$CONF/before-start/*
for f in $FILES
do
echo "Attaching: $f"
......@@ -14,46 +28,72 @@ if [[ -d /root/conf/before-start ]] ; then
done
fi
# Run start script.
source /root/conf/start.sh
echo "\n****** in run.sh ********\n"
if [[ -f $CONF/pre-install.sh ]] ; then
echo "Running: pre-install.sh"
source $CONF/pre-install.sh
fi
# Run after-run scripts added by another containers.
if [[ -d /root/conf/after-start ]] ; then
FILES=/root/conf/after-start/*
for f in $FILES
do
echo "Attaching: $f"
source $f
done
echo "starting services"
# first start couchdb
if [[ -f $COUCH/couchdb-init.sh ]] ; then
echo "starting couchdb via $COUCH/couchdb-init.sh"
$PM2 start --no-daemon $COUCH/couchdb-init.sh
fi
# next, get the Javascript code:
# get the repo
echo "moving to $WENOTES"
cd $WENOTES
echo "getting $WESERVER, putting it into server"
$GIT clone $WESERVER server
# get the repo
echo "getting $WETOOLS, putting it into server"
$GIT clone $WETOOLS tools
# set up options.json
if [[ "${BUILD_TEST}" = 1 ]] ; then
# Run tests.
REQUIREMENTS="/usr/bin/shunit2 /bin/nc"
for R in $REQUIREMENTS; do
if [[ ! -x "$R" ]] ; then
echo "Checking requirement $R... Not found. Aborting"
exit 1
fi
done
# Start nginx and php-fpm.
# /usr/bin/supervisord -c /etc/supervisor/supervisord.conf &
# And wait few seconds to be sure if it's running.
# sleep 8s
# next start various Javascript services
if [[ -f $CONF/faye.yml ]] ; then
echo "moving to server"
cd $WENOTES/server
echo "installing Node.JS dependencies"
$NPM install
$CP $CONF/options.json.sample options.json
echo "starting pm2 to supervise scripts in $CONF/faye.yml"
$PM2 start --no-daemon $CONF/faye.yml
cd $WENOTES
fi
# next start various Javascript services
if [[ -f $CONF/services.yml ]] ; then
cd $WENOTES/tools
echo "installing Node.JS dependencies"
$NPM install
$CP $CONF/options.json.sample options.json
echo "starting pm2 to supervise scripts in $CONF/services.yml"
$PM2 start --no-daemon $CONF/services.yml
cd $WENOTES
fi
echo "returning to original dir: $CWD"
cd $CWD
echo "finished services"
if [[ -f $CONF/post-install.sh ]] ; then
echo "Running: post-install.sh"
source $CONF/post-install.sh
fi
echo "\n****** in run.sh ********\n"
# Take all tests and run it one by one.
FILES=/root/conf/tests/*
# Run after-run scripts added by another containers.
if [[ -d $CONF/after-start ]] ; then
FILES=$CONF/after-start/*
for f in $FILES
do
echo "Running: $f"
$f
echo "Attaching: $f"
source $f
done
else
# Otherwise just use supervisord.
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
fi
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
FROM ubuntu:trusty
MAINTAINER Dave Lane dave@oerfoundation.org
# (adapted from work by Clemens Stolle klaemo@apache.org)
# Purpose - run a full WENotes stack including the faye message server,
# the wenotes service with couchdb, and various external processing tools
#
# The aim: to make a manageable fully functional dev environment which
# fosters remote API-ification for registering new blog users,
# updating details for session validation, and possibly integrating Mautic...
ENV APT_SERVER http://ucmirror.canterbury.ac.nz/ubuntu
ENV APT_FILE sources.list
ENV UBUNTU_NAME trusty
# subdue the "Dialog" errors...
ENV DEBIAN_FRONTEND noninteractive
ENV COUCHDIR /opt/couchdb
#
# Add CouchDB user account
RUN groupadd -r couchdb && useradd -d $COUCHDIR -g couchdb couchdb
#
# add local mirror to reduce build time :)
RUN echo "deb $APT_SERVER ${UBUNTU_NAME} main universe" > /etc/apt/${APT_FILE}
RUN echo "deb $APT_SERVER ${UBUNTU_NAME}-updates main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb $APT_SERVER ${UBUNTU_NAME}-security main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME} main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME}-updates main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME}-security main universe" >> /etc/apt/${APT_FILE}
# do one update and start installing...
RUN apt-get update -y && apt-get install -y --no-install-recommends \
apt-transport-https \
apt-utils \
ca-certificates \
curl \
git \
haproxy \
erlang-nox \
erlang-reltool \
libicu52 \
libmozjs185-1.0 \
openssl \
&& rm -rf /var/lib/apt/lists/*
# grab gosu for easy step-down from root and tini for signal handling
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture)" \
&& curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture).asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 6380DC428747F6C393FEACA59A84159D7001A4E5 \
&& curl -o /usr/local/bin/tini -fSL "https://github.com/krallin/tini/releases/download/v0.9.0/tini" \
&& curl -o /usr/local/bin/tini.asc -fSL "https://github.com/krallin/tini/releases/download/v0.9.0/tini.asc" \
&& gpg --verify /usr/local/bin/tini.asc \
&& rm /usr/local/bin/tini.asc \
&& chmod +x /usr/local/bin/tini
ENV COUCHDB_VERSION 2.0.0
# install Node.JS repos and do another update...
RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
&& echo 'deb https://deb.nodesource.com/node_4.x trusty main' > /etc/apt/sources.list.d/nodesource.list \
&& echo 'deb-src https://deb.nodesource.com/node_4.x trusty main' >> /etc/apt/sources.list.d/nodesource.list \
&& apt-get update -y -qq
# Download dev dependencies
RUN apt-get install -y --no-install-recommends \
build-essential \
erlang-dev \
libcurl4-openssl-dev \
libicu-dev \
libmozjs185-dev \
# install nodejs stack...
&& apt-get install -y nodejs \
&& npm install -g grunt-cli
# set up pm2
#RUN npm install -g pm2
# Acquire CouchDB source code
RUN cd /usr/src && mkdir couchdb \
&& curl -fSL https://dist.apache.org/repos/dist/release/couchdb/source/2.0.0/apache-couchdb-$COUCHDB_VERSION.tar.gz -o couchdb.tar.gz \
&& tar -xzf couchdb.tar.gz -C couchdb --strip-components=1 \
&& cd couchdb \
# Build the release and install into /opt
&& ./configure --disable-docs \
&& make release \
&& mv /usr/src/couchdb/rel/couchdb $COUCHDIR \
# Cleanup build detritus
&& apt-get purge -y \
binutils \
build-essential \
cpp \
git \
erlang-dev \
libicu-dev \
make \
perl \
&& apt-get autoremove -y && apt-get clean \
&& apt-get install -y libicu52 --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* /usr/lib/node_modules /usr/src/couchdb*
# Sprinkle couchdb configuration to the right places...
COPY couchdb/local.ini ${COUCHDIR}/etc/
COPY couchdb/vm.args ${COUCHDIR}/etc/
COPY couchdb/couchdb-init.sh /
# Setup directories and permissions
RUN chmod +x /couchdb-init.sh \
&& mkdir ${COUCHDIR}/data ${COUCHDIR}/etc/local.d ${COUCHDIR}/etc/default.d \
&& chown -R couchdb:couchdb ${COUCHDIR}
# Set up the language variables
ENV LANG en_NZ.UTF-8
ENV LANGUAGE en_NZ.UTF-8
ENV LC_ALL en_NZ.UTF-8
# Compile the language spec
RUN locale-gen $LANG
#
# Some final exports to get the environment right...
RUN echo "export VISIBLE=now" >> /etc/profile \
&& echo "export TERM=xterm" >> /etc/bash.bashrc
# expose relevant ports
WORKDIR ${COUCHDIR}
EXPOSE 5984 4369 9100
VOLUME ["${COUCHDIR}/data"]
ENTRYPOINT ["tini", "--", "/couchdb-init.sh"]
CMD ["/opt/couchdb/bin/couchdb"]
#!/bin/bash
# Bash hasn't been initialized yet so add path to composer manually.
#export PATH="$HOME/.composer/vendor/bin:$PATH"
# Run start script.
echo "*****Running run.sh"
CONF=/root/conf
COUCH=/root
CWD=`pwd`
PM2=`which pm2`
echo "CWD=$CWD, GIT=$GIT"
# Run before-run scripts added by another containers.
if [[ -d $CONF/before-start ]] ; then
FILES=$CONF/before-start/*
for f in $FILES
do
echo "Attaching: $f"
source $f
done
fi
if [[ -f $CONF/pre-install.sh ]] ; then
echo "Running: pre-install.sh"
source $CONF/pre-install.sh
fi
echo "starting services"
# first start couchdb
if [[ -f $COUCH/couchdb-init.sh ]] ; then
echo "starting couchdb via $COUCH/couchdb-init.sh"
$PM2 start --no-daemon $COUCH/couchdb-init.sh
fi
echo "finished services"
if [[ -f $CONF/post-install.sh ]] ; then
echo "Running: post-install.sh"
source $CONF/post-install.sh
fi
echo "\n****** in run.sh ********\n"
# Run after-run scripts added by another containers.
if [[ -d $CONF/after-start ]] ; then
FILES=$CONF/after-start/*
for f in $FILES
do
echo "Attaching: $f"
source $f
done
fi
......@@ -28,7 +28,14 @@ if [ "$1" = '/opt/couchdb/bin/couchdb' ]; then
if [ "$COUCHDB_USER" ] && [ "$COUCHDB_PASSWORD" ]; then
# Create admin
echo "Setting admin access details"
printf "[admins]\n%s = %s\n" "$COUCHDB_USER" "$COUCHDB_PASSWORD" > /opt/couchdb/etc/local.d/docker.ini
if [ "$COUCHDB_PROXYSECRET" ]; then
echo "Setting a proxy secret"
printf "[couch_httpd_auth\]\nrequire_valid_user = true\nsecret = %s\n" "$COUCHDB_PROXYSECRET" >> /opt/couchdb/etc/local.d/docker.ini
else
printf "[couch_httpd_auth\]\nrequire_valid_user = true\n" >> /opt/couchdb/etc/local.d/docker.ini
fi
chown couchdb:couchdb /opt/couchdb/etc/local.d/docker.ini
fi
......
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
FROM ubuntu:trusty
MAINTAINER Dave Lane dave@oerfoundation.org
# (adapted from work by Clemens Stolle klaemo@apache.org)
# Purpose - run a full WENotes stack including the faye message server,
# the wenotes service with couchdb, and various external processing tools
#
# The aim: to make a manageable fully functional dev environment which
# fosters remote API-ification for registering new blog users,
# updating details for session validation, and possibly integrating Mautic...
ENV APT_SERVER http://ucmirror.canterbury.ac.nz/ubuntu
ENV APT_FILE sources.list
ENV UBUNTU_NAME trusty
# subdue the "Dialog" errors...
ENV DEBIAN_FRONTEND noninteractive
#
# add local mirror to reduce build time :)
RUN echo "deb $APT_SERVER ${UBUNTU_NAME} main universe" > /etc/apt/${APT_FILE}
RUN echo "deb $APT_SERVER ${UBUNTU_NAME}-updates main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb $APT_SERVER ${UBUNTU_NAME}-security main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME} main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME}-updates main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME}-security main universe" >> /etc/apt/${APT_FILE}
# do one update and start installing...
RUN apt-get update -y && apt-get install -y --no-install-recommends \
apt-transport-https \
apt-utils \
ca-certificates \
curl \
git \
haproxy \
erlang-nox \
erlang-reltool \
libicu52 \
libmozjs185-1.0 \
openssl \
&& rm -rf /var/lib/apt/lists/*
# grab gosu for easy step-down from root and tini for signal handling
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture)" \
&& curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture).asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 6380DC428747F6C393FEACA59A84159D7001A4E5 \
&& curl -o /usr/local/bin/tini -fSL "https://github.com/krallin/tini/releases/download/v0.9.0/tini" \
&& curl -o /usr/local/bin/tini.asc -fSL "https://github.com/krallin/tini/releases/download/v0.9.0/tini.asc" \
&& gpg --verify /usr/local/bin/tini.asc \
&& rm /usr/local/bin/tini.asc \
&& chmod +x /usr/local/bin/tini
# install Node.JS repos and do another update...
RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
&& echo 'deb https://deb.nodesource.com/node_4.x trusty main' > /etc/apt/sources.list.d/nodesource.list \
&& echo 'deb-src https://deb.nodesource.com/node_4.x trusty main' >> /etc/apt/sources.list.d/nodesource.list \
&& apt-get update -y -qq
# Download dev dependencies
RUN apt-get install -y --no-install-recommends \
build-essential \
# erlang-dev \
# libcurl4-openssl-dev \
# libicu-dev \
# libmozjs185-dev \
# install nodejs stack...
&& apt-get install -y nodejs \
&& npm install -g grunt-cli
# set up pm2
RUN npm install -g pm2
# Cleanup build detritus
#RUN && apt-get purge -y \
# binutils \
# build-essential \
# cpp \
# erlang-dev \
# libicu-dev \
# make \
# perl \
RUN apt-get autoremove -y && apt-get clean
# && apt-get install -y libicu52 --no-install-recommends
# Set up the language variables
ENV LANG en_NZ.UTF-8
ENV LANGUAGE en_NZ.UTF-8
ENV LC_ALL en_NZ.UTF-8
# Compile the language spec
RUN locale-gen $LANG
#
# Some final exports to get the environment right...
RUN echo "export VISIBLE=now" >> /etc/profile \
&& echo "export TERM=xterm" >> /etc/bash.bashrc
# set up the various scripts we need to run on the container
# after it's built...
COPY ./conf /root/conf/
#Prepare the main install script
RUN chmod u+x /root/conf/*.sh
# expose relevant ports
EXPOSE 8380
# VOLUME ["/opt/wenotes"]