-
-
Save heartshare/4eb5cba77980f3d047c156a0e0e9054a to your computer and use it in GitHub Desktop.
Old Laravel Docker prod conf with richarvey image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# scripts/00-laravel-deploy.sh | |
php artisan route:cache | |
php artisan view:cache | |
php artisan config:cache | |
php artisan migrate --force | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:20-alpine AS front | |
WORKDIR /usr/src/app | |
COPY . . | |
RUN yarn install | |
RUN yarn build | |
# Dockerfile | |
# Use base image for container | |
FROM richarvey/nginx-php-fpm:3.1.6 AS back | |
# Copy all application code into your Docker container | |
COPY . . | |
# Allow composer to run as root | |
ENV COMPOSER_ALLOW_SUPERUSER 1 | |
# Install PHP dependencies | |
RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader --working-dir=/var/www/html | |
# Image config | |
ENV WEBROOT /var/www/html/public | |
ENV PHP_ERRORS_STDERR 1 | |
ENV RUN_SCRIPTS 1 | |
ENV REAL_IP_HEADER 1 | |
ENV SKIP_COMPOSER 1 | |
# Laravel config | |
ENV APP_ENV production | |
ENV APP_DEBUG false | |
ENV LOG_CHANNEL stderr | |
COPY --from=front /usr/src/app/public/build ./public/build | |
COPY docker/ . | |
CMD ["/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# conf/nginx/nginx-site.conf | |
server { | |
# Render provisions and terminates SSL | |
listen 80; | |
# Make site accessible from http://localhost/ | |
server_name _; | |
root /var/www/html/public; | |
index index.html index.htm index.php; | |
# Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html | |
sendfile off; | |
# Add stdout logging | |
error_log /dev/stdout info; | |
access_log /dev/stdout; | |
# Block access to sensitive information about git | |
location /.git { | |
deny all; | |
return 403; | |
} | |
add_header X-Frame-Options "SAMEORIGIN"; | |
add_header X-XSS-Protection "1; mode=block"; | |
add_header X-Content-Type-Options "nosniff"; | |
charset utf-8; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location = /favicon.ico { access_log off; log_not_found off; } | |
location = /robots.txt { access_log off; log_not_found off; } | |
error_page 404 /index.php; | |
location ~* \.(jpg|jpeg|gif|png|css|js|ico|webp|tiff|ttf|svg)$ { | |
expires 5d; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
include fastcgi_params; | |
} | |
# deny access to . files | |
location ~ /\. { | |
log_not_found off; | |
deny all; | |
} | |
location ~ /\.(?!well-known).* { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment