From 05d9f5876deb1e9f31489ee1fc69944d366ef373 Mon Sep 17 00:00:00 2001 From: kushal-saha Date: Tue, 5 May 2026 11:03:17 +0000 Subject: [PATCH] feature: add docker configs --- docker-compose.yml | 69 +++++++++++++++++++++++++++++++++++++++ docker/nginx/default.conf | 26 +++++++++++++++ docker/php/Dockerfile | 38 +++++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 docker-compose.yml create mode 100644 docker/nginx/default.conf create mode 100644 docker/php/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b06e556 --- /dev/null +++ b/docker-compose.yml @@ -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: diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf new file mode 100644 index 0000000..b84ed0c --- /dev/null +++ b/docker/nginx/default.conf @@ -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; + } +} diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile new file mode 100644 index 0000000..9974bb3 --- /dev/null +++ b/docker/php/Dockerfile @@ -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"]