Simplify Dockerfile for Laravel API (remove monorepo assets stage), add nginx config, PHP 8.4
API CI/CD / Validate (composer + pint) (push) Successful in 2m8s
API CI/CD / Test (PHPUnit) (push) Failing after 2m22s
API CI/CD / Build frontend assets (push) Successful in 2m18s
API CI/CD / Security audit (push) Successful in 31s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 2m8s
API CI/CD / Test (PHPUnit) (push) Failing after 2m22s
API CI/CD / Build frontend assets (push) Successful in 2m18s
API CI/CD / Security audit (push) Successful in 31s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
+1
-14
@@ -8,19 +8,7 @@ COPY . .
|
||||
RUN composer dump-autoload --optimize \
|
||||
&& php artisan package:discover --ansi
|
||||
|
||||
FROM node:20-alpine AS assets
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json* pnpm-lock.yaml* yarn.lock* ./
|
||||
RUN if [ -f package-lock.json ]; then npm ci; \
|
||||
elif [ -f yarn.lock ]; then yarn install --frozen-lockfile; \
|
||||
elif [ -f pnpm-lock.yaml ]; then corepack enable && pnpm install --frozen-lockfile; \
|
||||
else npm install; fi
|
||||
COPY resources ./resources
|
||||
COPY vite.config.js ./
|
||||
COPY public ./public
|
||||
RUN if [ -f package.json ]; then npm run build; fi
|
||||
|
||||
FROM php:8.2-fpm
|
||||
FROM php:8.4-fpm
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
@@ -39,7 +27,6 @@ RUN apt-get update \
|
||||
WORKDIR /var/www/html
|
||||
|
||||
COPY --from=vendor /app /var/www/html
|
||||
COPY --from=assets /app/public /var/www/html/public
|
||||
|
||||
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /var/www/html/public;
|
||||
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
|
||||
index index.php;
|
||||
|
||||
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 ~ \.php$ {
|
||||
fastcgi_pass app:9000;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user