Add Docker and Nginx configuration for Cloud Run deployment

This commit is contained in:
Frank John Begornia
2025-08-12 00:28:17 +08:00
parent f197490606
commit 88912ee8e3
8 changed files with 353 additions and 44 deletions

View File

@@ -1,4 +1,3 @@
version: '3'
services:
#PHP Service
@@ -6,34 +5,64 @@ services:
build:
context: .
dockerfile: Dockerfile
args:
- APP_ENV=production
image: digitalocean.com/php
container_name: app
restart: unless-stopped
tty: true
deploy:
resources:
limits:
cpus: '0.50'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
environment:
SERVICE_NAME: app
SERVICE_TAGS: dev
APP_ENV: production
APP_DEBUG: 'false'
PHP_OPCACHE_VALIDATE_TIMESTAMPS: 0
working_dir: /var/www
volumes:
- ./:/var/www
- ./storage:/var/www/storage
- ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
networks:
- app-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/"]
interval: 30s
timeout: 3s
retries: 3
#Nginx Service
webserver:
image: nginx:alpine
container_name: webserver
restart: unless-stopped
tty: true
deploy:
resources:
limits:
cpus: '0.30'
memory: 256M
reservations:
cpus: '0.10'
memory: 128M
ports:
- "10003:80"
- "10443:443"
volumes:
- ./:/var/www
- ./public:/var/www/public
- ./nginx/conf.d/:/etc/nginx/conf.d/
networks:
- app-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/"]
interval: 30s
timeout: 3s
retries: 3
depends_on:
app:
condition: service_healthy
#Docker Networks
networks: