40 - Fix Livewire assets and Caddy config for production
All checks were successful
Build and Push Docker Image / build (push) Successful in 26m51s
All checks were successful
Build and Push Docker Image / build (push) Successful in 26m51s
This commit is contained in:
parent
7b3a59da10
commit
baabd06b24
1 changed files with 11 additions and 11 deletions
22
Dockerfile
22
Dockerfile
|
|
@ -14,7 +14,7 @@ ENV APP_ENV=production \
|
||||||
CACHE_STORE=redis \
|
CACHE_STORE=redis \
|
||||||
QUEUE_CONNECTION=redis \
|
QUEUE_CONNECTION=redis \
|
||||||
LOG_CHANNEL=stack \
|
LOG_CHANNEL=stack \
|
||||||
LOG_LEVEL=error
|
LOG_LEVEL=${LOG_LEVEL:-error}
|
||||||
|
|
||||||
# Copy application code first
|
# Copy application code first
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
@ -31,11 +31,11 @@ RUN npm run build
|
||||||
# Remove node_modules after build to save space
|
# Remove node_modules after build to save space
|
||||||
RUN rm -rf node_modules
|
RUN rm -rf node_modules
|
||||||
|
|
||||||
# Publish Livewire assets and Laravel optimizations
|
# Publish Livewire assets
|
||||||
RUN php artisan livewire:publish --assets \
|
RUN php artisan livewire:publish --assets
|
||||||
&& php artisan config:cache \
|
|
||||||
&& php artisan route:cache \
|
# Laravel optimizations (skip config and route cache - they need runtime env vars)
|
||||||
&& php artisan view:cache \
|
RUN php artisan view:cache \
|
||||||
&& composer dump-autoload --optimize
|
&& composer dump-autoload --optimize
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
|
|
@ -51,13 +51,9 @@ RUN cat > /etc/caddy/Caddyfile <<EOF
|
||||||
:8000 {
|
:8000 {
|
||||||
root * /app/public
|
root * /app/public
|
||||||
|
|
||||||
php_server {
|
|
||||||
index index.php
|
|
||||||
}
|
|
||||||
|
|
||||||
encode gzip
|
encode gzip
|
||||||
|
|
||||||
file_server
|
php_server
|
||||||
|
|
||||||
header {
|
header {
|
||||||
X-Frame-Options "SAMEORIGIN"
|
X-Frame-Options "SAMEORIGIN"
|
||||||
|
|
@ -90,6 +86,10 @@ for i in $(seq 1 30); do
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Cache config with runtime env vars
|
||||||
|
echo "Caching configuration..."
|
||||||
|
php artisan config:cache
|
||||||
|
|
||||||
# Run migrations
|
# Run migrations
|
||||||
echo "Running migrations..."
|
echo "Running migrations..."
|
||||||
php artisan migrate --force || echo "Migrations failed or already up-to-date"
|
php artisan migrate --force || echo "Migrations failed or already up-to-date"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue