diff --git a/Dockerfile b/Dockerfile index ec0de61..19a3afc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,19 +57,19 @@ RUN docker-php-ext-install pdo_pgsql # Get latest Composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # Copy php.ini file -COPY php/php.ini $PHP_INI_DIR/conf.d/ +COPY php.ini $PHP_INI_DIR/conf.d/ # Install Laravel Envoy RUN composer global require "laravel/envoy=~1.0" #--------------------Add supervisor file in supervisor directory ------------------------------------ -ADD worker/supervisord.conf /etc/supervisor/conf.d/worker.conf +#ADD worker/supervisord.conf /etc/supervisor/conf.d/worker.conf -# Add crontab file in the cron directory -ADD worker/crontab /etc/cron.d/crontab +COPY ./entrypoint.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/entrypoint.sh +RUN ln -s /usr/local/bin/entrypoint.sh / -# Give execution rights on the cron job -RUN chmod 0644 /etc/cron.d/crontab +ENTRYPOINT ["entrypoint.sh"] # Set working directory WORKDIR $WORKDIR @@ -77,6 +77,7 @@ WORKDIR $WORKDIR RUN usermod -u 1000 www-data RUN groupmod -g 1000 www-data + EXPOSE 9000 # Run Supervisor CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"] diff --git a/README.md b/README.md index c2e4fc6..d6a586c 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ services: volumes: #Project root - ./:/var/www/ + - ~/.ssh:/root/.ssh # If you use private CVS + networks: - default #if you're using networks between containers @@ -51,6 +53,7 @@ php atisan migrate ``` ## Example Laravel-php-fpm with nginx: +### file= docker-compose.yml ```yml version: '3' services: @@ -61,6 +64,8 @@ services: volumes: #Project root - ./:/var/www/ + - ~/.ssh:/root/.ssh # If you use private CVS + networks: - default #if you're using networks between containers #Nginx server @@ -79,6 +84,7 @@ services: ``` ## Simple Nginx config file content +### file= nginx/conf.d/default.conf ```conf diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..106b73e --- /dev/null +++ b/build.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +if [ $# -eq 0 ] + then + tag='latest' + else + tag=$1 +fi + +docker build -t jkaninda/laravel-php-fpm:$tag . \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..b33efe8 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,49 @@ +#!/bin/sh +echo "" +echo "***********************************************************" +echo " Starting LARAVEL PHP-FPM Docker Container " +echo "***********************************************************" + +set -e + +TASK=/etc/supervisor/conf.d/worker.conf +touch $TASK +cat > "$TASK" <