2014-09-30 20:30:20 +08:00
|
|
|
FROM debian:jessie
|
2014-09-15 16:41:48 +08:00
|
|
|
MAINTAINER "Konrad Kleine"
|
|
|
|
|
2014-10-14 16:24:33 +08:00
|
|
|
|
2014-09-29 20:04:40 +08:00
|
|
|
USER root
|
|
|
|
|
|
|
|
############################################################
|
|
|
|
# Setup environment variables
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
ENV WWW_DIR /var/www/html
|
2014-09-17 20:51:34 +08:00
|
|
|
ENV SOURCE_DIR /tmp/source
|
2014-09-29 20:04:40 +08:00
|
|
|
ENV START_SCRIPT /root/start-apache.sh
|
|
|
|
|
2014-10-23 15:41:44 +08:00
|
|
|
RUN mkdir -pv $WWW_DIR
|
|
|
|
|
2014-10-14 16:24:33 +08:00
|
|
|
############################################################
|
|
|
|
# Speedup DPKG and don't use cache for packages
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
# Taken from here: https://gist.github.com/kwk/55bb5b6a4b7457bef38d
|
|
|
|
#
|
|
|
|
# this forces dpkg not to call sync() after package extraction and speeds up
|
|
|
|
# install
|
|
|
|
RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup
|
|
|
|
# # we don't need and apt cache in a container
|
|
|
|
RUN echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache
|
|
|
|
|
2014-09-18 16:53:21 +08:00
|
|
|
############################################################
|
|
|
|
|
|
|
|
# Create dirs
|
2015-09-17 19:32:58 +08:00
|
|
|
RUN mkdir -p $SOURCE_DIR/dist \
|
|
|
|
$SOURCE_DIR/app \
|
|
|
|
$SOURCE_DIR/test \
|
|
|
|
$SOURCE_DIR/.git
|
2014-09-18 16:53:21 +08:00
|
|
|
|
|
|
|
# Add dirs
|
|
|
|
ADD app $SOURCE_DIR/app
|
|
|
|
ADD test $SOURCE_DIR/test
|
|
|
|
|
|
|
|
# Dot files
|
|
|
|
ADD .jshintrc $SOURCE_DIR/
|
|
|
|
ADD .bowerrc $SOURCE_DIR/
|
|
|
|
ADD .editorconfig $SOURCE_DIR/
|
|
|
|
ADD .travis.yml $SOURCE_DIR/
|
|
|
|
|
|
|
|
# Other files
|
|
|
|
ADD bower.json $SOURCE_DIR/
|
|
|
|
ADD Gruntfile.js $SOURCE_DIR/
|
|
|
|
ADD LICENSE $SOURCE_DIR/
|
|
|
|
ADD package.json $SOURCE_DIR/
|
|
|
|
ADD README.md $SOURCE_DIR/
|
|
|
|
|
2015-09-17 19:32:58 +08:00
|
|
|
# Add some git files for versioning
|
2014-10-23 15:41:44 +08:00
|
|
|
ADD .git/HEAD $SOURCE_DIR/.git/HEAD
|
|
|
|
ADD .git/refs $SOURCE_DIR/.git/refs
|
|
|
|
|
2014-09-18 16:53:21 +08:00
|
|
|
############################################################
|
2015-09-17 19:32:58 +08:00
|
|
|
# Install and configure webserver software
|
2014-09-18 16:53:21 +08:00
|
|
|
############################################################
|
|
|
|
|
2015-09-17 19:32:58 +08:00
|
|
|
RUN apt-get -y update && \
|
|
|
|
export DEBIAN_FRONTEND=noninteractive && \
|
|
|
|
apt-get -y install \
|
|
|
|
apache2 \
|
2016-07-19 16:16:14 +08:00
|
|
|
bzip2 \
|
2015-09-17 19:32:58 +08:00
|
|
|
libapache2-mod-auth-kerb \
|
|
|
|
libapache2-mod-proxy-html \
|
2014-09-22 18:00:29 +08:00
|
|
|
git \
|
|
|
|
nodejs \
|
|
|
|
nodejs-legacy \
|
2014-09-29 20:04:40 +08:00
|
|
|
npm \
|
2014-09-30 20:30:20 +08:00
|
|
|
--no-install-recommends && \
|
2015-09-17 19:32:58 +08:00
|
|
|
a2enmod proxy && \
|
|
|
|
a2enmod proxy_http && \
|
|
|
|
cd $SOURCE_DIR && \
|
|
|
|
export GITREF=$(cat .git/HEAD | cut -d" " -f2) && \
|
|
|
|
export GITSHA1=$(cat .git/$GITREF) && \
|
|
|
|
echo "{\"git\": {\"sha1\": \"$GITSHA1\", \"ref\": \"$GITREF\"}}" > $WWW_DIR/app-version.json && \
|
|
|
|
cd $SOURCE_DIR && \
|
|
|
|
rm -rf $SOURCE_DIR/.git && \
|
2015-01-02 18:10:16 +08:00
|
|
|
git config --global url."https://".insteadOf git:// && \
|
2014-09-17 23:39:47 +08:00
|
|
|
cd $SOURCE_DIR && \
|
|
|
|
npm install && \
|
2014-10-07 21:45:30 +08:00
|
|
|
node_modules/bower/bin/bower install --allow-root && \
|
|
|
|
node_modules/grunt-cli/bin/grunt build --allow-root && \
|
2014-09-29 20:04:40 +08:00
|
|
|
cp -rf $SOURCE_DIR/dist/* $WWW_DIR && \
|
2014-09-18 20:08:44 +08:00
|
|
|
rm -rf $SOURCE_DIR && \
|
2016-07-19 16:16:14 +08:00
|
|
|
apt-get -y --auto-remove purge git nodejs nodejs-legacy npm bzip2 && \
|
2015-09-17 19:32:58 +08:00
|
|
|
apt-get -y autoremove && \
|
2014-10-22 15:31:36 +08:00
|
|
|
apt-get -y clean && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
2014-09-17 23:39:47 +08:00
|
|
|
|
2014-09-29 20:04:40 +08:00
|
|
|
############################################################
|
|
|
|
# Add and enable the apache site and disable all other sites
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
RUN a2dissite 000*
|
|
|
|
ADD apache-site.conf /etc/apache2/sites-available/docker-site.conf
|
|
|
|
RUN a2ensite docker-site.conf
|
|
|
|
|
|
|
|
ADD start-apache.sh $START_SCRIPT
|
|
|
|
RUN chmod +x $START_SCRIPT
|
|
|
|
|
2014-09-30 20:30:20 +08:00
|
|
|
ENV APACHE_RUN_USER www-data
|
|
|
|
ENV APACHE_RUN_GROUP www-data
|
|
|
|
ENV APACHE_LOG_DIR /var/log/apache2
|
|
|
|
|
2014-09-29 20:04:40 +08:00
|
|
|
# Let people know how this was built
|
|
|
|
ADD Dockerfile /root/Dockerfile
|
2014-09-17 23:39:47 +08:00
|
|
|
|
|
|
|
# Exposed ports
|
|
|
|
EXPOSE 80 443
|
2014-09-15 22:20:30 +08:00
|
|
|
|
2014-09-29 20:04:40 +08:00
|
|
|
VOLUME ["/etc/apache2/server.crt", "/etc/apache2/server.key"]
|
2014-09-17 22:59:58 +08:00
|
|
|
|
2014-09-29 20:04:40 +08:00
|
|
|
CMD $START_SCRIPT
|