Skip to content

Commit

Permalink
Update docker startup script with no reload option (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricklambrechts committed Feb 14, 2024
1 parent c5cce42 commit 637cd2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .env.ci
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
APP_NAME=Laravel
APP_ENV=ci
APP_ENV=local
APP_KEY=base64:Mck3KC6nW1/ib28ZVH66RGpE61ZDRYD4vqP2wN23cak=
APP_DEBUG=true
APP_URL=http://localhost
Expand Down
18 changes: 13 additions & 5 deletions docker/scripts/startup.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash

# set application directory
APP_DIR=${APP_DIR:-/app}

# set default app host and port when not set
APP_HOST=${APP_HOST:-0.0.0.0}
APP_PORT=${APP_PORT:-8000}
# Needs to be 0.0.0.0 for Docker
ARTISAN_SERVE_HOST=0.0.0.0
# Needs to be the port that is exposed in the Dockerfile
ARTISAN_SERVE_PORT=8000
ARTISAN_SERVE_NO_RELOAD=${ARTISAN_SERVE_NO_RELOAD:-true}

cd $APP_DIR

Expand All @@ -31,6 +32,13 @@ if [ ! -f $APP_DIR/.env ]; then
cp $APP_DIR/.env.ci $APP_DIR/.env
fi

# set no reload argument if ARTISAN_SERVE_NO_RELOAD is set to true
# with no reload the server will use all the environment variables
ARTISAN_NO_RELOAD_ARGUMENT=''
if [ "$ARTISAN_SERVE_NO_RELOAD" = "true" ]; then
ARTISAN_NO_RELOAD_ARGUMENT='--no-reload'
fi

# run the application
# FYI: you should not use php artisan serve in production
php artisan serve --host=$APP_HOST --port=$APP_PORT
php artisan serve --host=$ARTISAN_SERVE_HOST --port=$ARTISAN_SERVE_PORT $ARTISAN_NO_RELOAD_ARGUMENT

0 comments on commit 637cd2e

Please sign in to comment.