Made container configurable

This commit is contained in:
aviau 2015-04-23 10:51:43 -04:00
parent a93899fd40
commit 162511b070
5 changed files with 32 additions and 5 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
.git
node_modules
.sass-cache

View File

@ -15,7 +15,13 @@ RUN mkdir -p /var/lock/apache2 /var/run/apache2 /var/run/sshd
# Configure Apache2 for reverse-proxying
ADD container/000-default.conf etc/apache2/sites-enabled/000-default.conf
ADD container/ports.conf etc/apache2/ports.conf
RUN a2enmod proxy
RUN a2enmod proxy_http
# configure script
ADD container/configure.sh /configure.sh
# Bansho files
ADD /package.json /opt/adagios-frontend/package.json
ADD /.bowerrc /opt/adagios-frontend/.bowerrc
ADD /.jshintrc /opt/adagios-frontend/.jshintrc
@ -24,8 +30,13 @@ ADD /bower.json /opt/adagios-frontend/bower.json
RUN cd /opt/adagios-frontend/ && npm install --unsafe-perm
ADD /app /opt/adagios-frontend/app
RUN a2enmod proxy
RUN a2enmod proxy_http
# Override those variables at runtime to point Bansho to another backend
ENV BANSHO_BACKEND surveil
ENV BANSHO_SURVEIL_URL http://surveil:8080/
ENV BANSHO_ADAGIOS_URL http://demo.kaji-project.org/
CMD ((cd /opt/adagios-frontend && grunt sass && grunt uglify && grunt) &) && \
CMD ./configure.sh && \
cd /opt/adagios-frontend && \
grunt sass && \
grunt uglify:${BANSHO_BACKEND} && \
bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND"

View File

@ -314,5 +314,5 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jslint');
grunt.registerTask('default', ['watch', 'jslint', 'uglify']);
grunt.registerTask('default', ['watch']);
};

View File

@ -13,10 +13,10 @@ interactive:
daemon:
sudo docker run -p 8888:8888 --link surveil_surveil_1:surveil -v ${PWD}:/opt/adagios-frontend -d -t --name adg-fe adg-fe
grunt watch
kill:
sudo docker kill adg-fe
remove:
sudo docker rm adg-fe

13
container/configure.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
CONFIG_FILE="/etc/apache2/sites-enabled/000-default.conf"
echo "=> Configuring apache ProxyPass ..."
# Surveil URLS
sed -i "s|ProxyPass /surveil/.*|ProxyPass /surveil/ ${BANSHO_SURVEIL_URL}|g" ${CONFIG_FILE}
sed -i "s|ProxyPassReverse /surveil/.*|ProxyPassReverse /surveil/ ${BANSHO_SURVEIL_URL}|g" ${CONFIG_FILE}
# Adagios URLS
sed -i "s|ProxyPass /adagios/.*|ProxyPass /adagios/ ${BANSHO_ADAGIOS_URL}|g" ${CONFIG_FILE}
sed -i "s|ProxyPassReverse /adagios/.*|ProxyPassReverse /adagios/ ${BANSHO_ADAGIOS_URL}|g" ${CONFIG_FILE}