update docker
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
.git
|
||||
.github
|
||||
node_modules
|
||||
vendor
|
||||
storage/*.key
|
||||
.env
|
||||
.phpunit.result.cache
|
||||
Docker/Dockerfile
|
||||
@@ -0,0 +1,65 @@
|
||||
services:
|
||||
# ==========================================
|
||||
# 1. Laravel Application (PHP-FPM)
|
||||
# ==========================================
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
APP_NAME: ${APP_NAME:-Laravel}
|
||||
APP_ENV: ${APP_ENV:-production}
|
||||
APP_KEY: ${APP_KEY}
|
||||
APP_DEBUG: ${APP_DEBUG:-false}
|
||||
APP_URL: ${APP_URL}
|
||||
|
||||
DB_CONNECTION: pgsql
|
||||
DB_HOST: db
|
||||
DB_PORT: 5432
|
||||
|
||||
DB_DATABASE: ${DB_DATABASE}
|
||||
DB_USERNAME: ${DB_USERNAME}
|
||||
DB_PASSWORD: ${DB_PASSWORD}
|
||||
|
||||
FILESYSTEM_DISK: public
|
||||
volumes:
|
||||
- public_files:/var/www/html/public
|
||||
- upload_files:/var/www/html/storage/app/public
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
# ==========================================
|
||||
# 2. Web Server (Custom Nginx)
|
||||
# ==========================================
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/nginx.Dockerfile
|
||||
restart: unless-stopped
|
||||
expose:
|
||||
- "80"
|
||||
volumes:
|
||||
- public_files:/var/www/html/public:ro
|
||||
depends_on:
|
||||
- app
|
||||
|
||||
# ==========================================
|
||||
# 3. Database (Custom PostgreSQL)
|
||||
# ==========================================
|
||||
db:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/postgres.Dockerfile
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${DB_DATABASE}
|
||||
POSTGRES_USER: ${DB_USERNAME}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
volumes:
|
||||
- db_data:/var/lib/postgresql/data
|
||||
|
||||
volumes:
|
||||
db_data:
|
||||
public_files:
|
||||
upload_files:
|
||||
@@ -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
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
FROM postgres:15-alpine
|
||||
|
||||
COPY docker/humicpro_cetaksuratkp.sql /docker-entrypoint-initdb.d/
|
||||
Reference in New Issue
Block a user