feat(docker): add Docker configuration and production environment setup
This commit is contained in:
33
docker/entrypoint.sh
Normal file
33
docker/entrypoint.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
mkdir -p \
|
||||
storage/app/public \
|
||||
storage/framework/cache/data \
|
||||
storage/framework/sessions \
|
||||
storage/framework/views \
|
||||
storage/logs \
|
||||
bootstrap/cache
|
||||
|
||||
if [ ! -L public/storage ]; then
|
||||
rm -rf public/storage
|
||||
ln -s ../storage/app/public public/storage
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
chown -R www-data:www-data storage bootstrap/cache
|
||||
fi
|
||||
|
||||
if [ -z "${APP_KEY:-}" ]; then
|
||||
echo "ERROR: APP_KEY is empty. Set it in .env.production, then restart containers." >&2
|
||||
echo " php artisan key:generate --show" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${APP_ENV:-production}" = "production" ]; then
|
||||
php artisan config:cache --no-interaction
|
||||
php artisan event:cache --no-interaction
|
||||
php artisan view:cache --no-interaction
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user