Skip to content

Commit

Permalink
Run composer install when building docker for production
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltrolezi committed Oct 7, 2024
1 parent cf81dff commit 293798a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ WORKDIR /var/www/gamewatch
COPY . /var/www/gamewatch
COPY ./docker/php "${PHP_INI_DIR}/conf.d/"
COPY ./docker/supervisor /etc/supervisor/
COPY ./docker/supervisor/conf.d/octane.${APP_ENV} /etc/supervisor/conf.d/octane.conf
COPY ./docker/nginx/default.conf /etc/nginx/conf.d/

RUN if [ "$APP_ENV" = "local" ]; then \
apt-get update && apt-get install -y nano npm; \
fi

RUN if [ "$APP_ENV" = "production" ]; then \
composer install --no-interaction --optimize-autoloader --no-dev; \
fi

#RUN find /var/www/gamewatch -not -path "/var/www/gamewatch/vendor/*" -type f -exec chmod 644 {} \; \
# && find /var/www/gamewatch -type d -exec chmod 755 {} \; \
# && chown -R www-data:www-data /var/www/gamewatch \
Expand Down
10 changes: 1 addition & 9 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,12 @@ if [ ! -d "vendor" ] || [ -z "$(ls -A vendor)" ]; then
npm install

php artisan key:generate --ansi
php artisan migrate --seed
else
composer install --no-interaction --optimize-autoloader --no-dev
php artisan migrate --seed
fi
fi

case "$RUN_MODE" in
octane)
if [ "$APP_ENV" == "local" ]; then
cp /etc/supervisor/conf.d/octane.dev /etc/supervisor/conf.d/octane.conf
else
cp /etc/supervisor/conf.d/octane.prod /etc/supervisor/conf.d/octane.conf
fi

supervisord -c /etc/supervisor/supervisord.conf
;;
notif)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[program:octane-dev]
[program:octane]
command=php artisan octane:swoole --watch
autostart=true
autorestart=true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[program:octane-prod]
[program:octane]
command=php artisan octane:swoole --workers=4 --task-workers=4
autostart=true
autorestart=true
Expand Down

0 comments on commit 293798a

Please sign in to comment.