diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4de735c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +node_modules +.sass-cache diff --git a/Dockerfile b/Dockerfile index 53f5cab..30502a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" diff --git a/Gruntfile.js b/Gruntfile.js index 53661ce..a0dc310 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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']); }; diff --git a/Makefile b/Makefile index b0a39aa..b267dae 100644 --- a/Makefile +++ b/Makefile @@ -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 - diff --git a/container/configure.sh b/container/configure.sh new file mode 100755 index 0000000..c6812b7 --- /dev/null +++ b/container/configure.sh @@ -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}