diff --git a/Dockerfile b/Dockerfile index 1af2cbfc..9ce3e348 100644 --- a/Dockerfile +++ b/Dockerfile @@ -90,7 +90,7 @@ RUN wget ${archive_url} && \ COPY conf/php-fpm-pool.conf /etc/php7/php-fpm.d/www.conf COPY conf/supervisord.conf /etc/supervisor/supervisord.conf COPY conf/nginx.conf /etc/nginx/nginx.conf -COPY conf/nginx-site.conf /etc/nginx/conf.d/default.conf +COPY conf/nginx-site.conf.template /etc/nginx/conf.d/default.conf.template COPY conf/.env.docker /var/www/html/.env COPY entrypoint.sh /sbin/entrypoint.sh diff --git a/conf/.env.docker b/conf/.env.docker index c3d7a751..32171d23 100644 --- a/conf/.env.docker +++ b/conf/.env.docker @@ -12,6 +12,8 @@ DB_PASSWORD="{{DB_PASSWORD}}" DB_PORT="{{DB_PORT}}" DB_PREFIX="{{DB_PREFIX}}" +PORT="{{PORT}}" + DOCKER=true CACHE_DRIVER="{{CACHE_DRIVER}}" diff --git a/conf/nginx-site.conf b/conf/nginx-site.conf.template similarity index 88% rename from conf/nginx-site.conf rename to conf/nginx-site.conf.template index 08971839..ca070b77 100644 --- a/conf/nginx-site.conf +++ b/conf/nginx-site.conf.template @@ -1,6 +1,6 @@ server { - listen 8000 default; ## Listen for ipv4; this line is default and implied - listen [::]:8000 default; ## Listen for ipv6 + listen $PORT default; ## Listen for ipv4; this line is default and implied + listen [::]:$PORT default; ## Listen for ipv6 # Make site accessible from http://localhost/ server_name localhost; diff --git a/docker-compose.yml b/docker-compose.yml index 97776a9d..58c12495 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,6 +31,7 @@ services: - APP_ENV=${APP_ENV:-production} - APP_DEBUG=false - DEBUG=false + - PORT=8000 depends_on: - postgres restart: on-failure diff --git a/entrypoint.sh b/entrypoint.sh index b13a4cb5..c5559dd5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -75,6 +75,7 @@ initialize_system() { APP_DEBUG=${APP_DEBUG:-true} APP_URL=${APP_URL:-http://localhost} APP_LOG=${APP_LOG:-errorlog} + PORT=${PORT:-8000} DB_DRIVER=${DB_DRIVER:-pgsql} DB_HOST=${DB_HOST:-postgres} @@ -228,6 +229,7 @@ start_system() { seed_db echo "Starting Cachet! ..." php artisan config:cache + envsubst '\$PORT' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf }