feature: add docker configs
This commit is contained in:
parent
d5fd7a8396
commit
05d9f5876d
69
docker-compose.yml
Normal file
69
docker-compose.yml
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
services:
|
||||||
|
# Laravel App (PHP-FPM)
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/php/Dockerfile
|
||||||
|
container_name: laravel_app
|
||||||
|
restart: unless-stopped
|
||||||
|
working_dir: /var/www/html/backend
|
||||||
|
volumes:
|
||||||
|
- ./backend:/var/www/html/backend
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
|
||||||
|
# Nginx Web Server
|
||||||
|
webserver:
|
||||||
|
image: nginx:alpine
|
||||||
|
container_name: laravel_nginx
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "8000:80"
|
||||||
|
volumes:
|
||||||
|
- ./backend:/var/www/html/backend
|
||||||
|
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
|
||||||
|
# PostgreSQL Database
|
||||||
|
# (Note: Set to PostgreSQL per your 8.5/PostgreSQL/Node 24 requirement)
|
||||||
|
db:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
container_name: laravel_db
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: neoban
|
||||||
|
POSTGRES_USER: neoban
|
||||||
|
POSTGRES_PASSWORD: secret
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
- dbdata:/var/lib/postgresql/data
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
|
||||||
|
# Angular Frontend
|
||||||
|
frontend:
|
||||||
|
image: node:24-alpine
|
||||||
|
container_name: angular_frontend
|
||||||
|
restart: unless-stopped
|
||||||
|
working_dir: /app/frontend
|
||||||
|
volumes:
|
||||||
|
- ./frontend:/app/frontend
|
||||||
|
ports:
|
||||||
|
- "4200:4200"
|
||||||
|
# Runs install and starts Angular bound to 0.0.0.0 so it is accessible outside the container
|
||||||
|
command: sh -c "npm install && npx ng serve --host 0.0.0.0 --poll 2000"
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
app-network:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
dbdata:
|
||||||
26
docker/nginx/default.conf
Normal file
26
docker/nginx/default.conf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
root /var/www/html/backend/public;
|
||||||
|
index index.php index.html;
|
||||||
|
|
||||||
|
# Max upload size
|
||||||
|
client_max_body_size 50M;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass app:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.ht {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
||||||
38
docker/php/Dockerfile
Normal file
38
docker/php/Dockerfile
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
FROM php:8.5-fpm
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
libpng-dev \
|
||||||
|
libjpeg-dev \
|
||||||
|
libfreetype6-dev \
|
||||||
|
libonig-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
libzip-dev \
|
||||||
|
libpq-dev \
|
||||||
|
zip \
|
||||||
|
unzip \
|
||||||
|
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||||
|
&& docker-php-ext-install \
|
||||||
|
pdo \
|
||||||
|
pdo_pgsql \
|
||||||
|
mbstring \
|
||||||
|
exif \
|
||||||
|
pcntl \
|
||||||
|
bcmath \
|
||||||
|
gd \
|
||||||
|
zip \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install Composer
|
||||||
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /var/www/html/backend
|
||||||
|
|
||||||
|
# Expose port 9000 for PHP-FPM
|
||||||
|
EXPOSE 9000
|
||||||
|
|
||||||
|
CMD ["php-fpm"]
|
||||||
Loading…
x
Reference in New Issue
Block a user