update docker

This commit is contained in:
2026-06-22 19:40:00 +07:00
parent c58c631b11
commit 2eedd58f29
8 changed files with 752 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
FROM node:20-alpine AS node-builder
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
RUN npm run build
FROM composer:2.8 AS php-builder
WORKDIR /app
COPY composer*.json ./
RUN composer install \
--no-dev \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist
COPY . .
RUN composer dump-autoload --no-dev --optimize
FROM php:8.4-fpm-alpine AS runtime
WORKDIR /var/www/html
RUN apk add --no-cache \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
zip \
libzip-dev \
unzip \
git \
oniguruma-dev \
postgresql-dev \
$PHPIZE_DEPS \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install pdo pdo_pgsql mbstring zip exif pcntl gd opcache
COPY docker/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
COPY --from=php-builder /app /var/www/html
COPY --from=node-builder /app/public /var/www/html/public
RUN ln -sf ../../storage/app/public /var/www/html/public/storage
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache \
&& chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
USER www-data
EXPOSE 9000
CMD ["php-fpm"]
File diff suppressed because one or more lines are too long
+5
View File
@@ -0,0 +1,5 @@
FROM nginx:alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
+38
View File
@@ -0,0 +1,38 @@
server {
listen 80;
listen [::]:80;
server_name _;
# Nginx will look for files in this directory
root /var/www/html/public;
# The default file to serve
index index.php index.html;
charset utf-8;
# Route all requests to index.php (Laravel's front controller)
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Serve static Vite assets directly (cache them for performance)
location ~* \.(jpg|jpeg|gif|png|css|js|ico|webp|svg|woff|woff2|ttf|eot|mp3|wav|ogg|pdf)$ {
expires max;
access_log off;
}
# Pass PHP scripts to the PHP-FPM container
location ~ \.php$ {
fastcgi_pass app:9000; # "app" is the name of the service in docker-compose.yml
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_hide_header X-Powered-By;
}
# Block access to hidden files (like .env or .git)
location ~ /\.(?!well-known).* {
deny all;
}
}
+8
View File
@@ -0,0 +1,8 @@
[opcache]
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000
opcache.revalidate_freq=0
opcache.validate_timestamps=0
opcache.fast_shutdown=1
+3
View File
@@ -0,0 +1,3 @@
FROM postgres:15-alpine
COPY docker/humicpro_cetaksuratkp.sql /docker-entrypoint-initdb.d/