refactor: update docker-compose.yml to define service names and improve structure

This commit is contained in:
2025-10-31 17:46:31 +01:00
parent 550f07df79
commit 77c4164dcb

View File

@@ -1,12 +1,18 @@
services: services:
node: isop-frontend:
container_name: node container_name: isop-frontend
build: build:
context: ../frontend context: ../frontend
dockerfile: Dockerfile dockerfile: Dockerfile
restart: unless-stopped restart: unless-stopped
ports:
- 80:80
environment:
NUXT_PUBLIC_SANCTUM_BASE_URL: http://localhost:8080
NUXT_PUBLIC_SANCTUM_ORIGIN: http://localhost
PORT: 80
depends_on: depends_on:
php-fpm: isop-backend:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost"] test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost"]
@@ -16,12 +22,12 @@ services:
retries: 5 retries: 5
# Caddy webserver # Caddy webserver
caddy: isop-backend:
container_name: caddy container_name: isop-backend
image: caddy:2.10.0-alpine image: caddy:2.10.0-alpine
restart: unless-stopped restart: unless-stopped
ports: ports:
- 80:80 # Needed for HTTP->HTTPS redirection - 8080:80 # Needed for HTTP->HTTPS redirection
- 443:443 - 443:443
- 443:443/udp - 443:443/udp
volumes: volumes:
@@ -34,7 +40,8 @@ services:
# Caddy configuration # Caddy configuration
- ./caddy-config:/config - ./caddy-config:/config
depends_on: depends_on:
- php-fpm isop-php-fpm:
condition: service_healthy
healthcheck: healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:2019/metrics"] test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:2019/metrics"]
start_period: 10s start_period: 10s
@@ -43,8 +50,8 @@ services:
retries: 5 retries: 5
# Custom PHP container # Custom PHP container
php-fpm: isop-php-fpm:
container_name: php-fpm container_name: isop-php-fpm
user: 'www-data:www-data' user: 'www-data:www-data'
build: build:
context: ../backend context: ../backend
@@ -52,8 +59,20 @@ services:
restart: unless-stopped restart: unless-stopped
env_file: env_file:
- ../backend/.env - ../backend/.env
environment:
APP_URL: http://localhost:8080
FRONTEND_URL: http://localhost
SESSION_DOMAIN: localhost
SESSION_SECURE_COOKIE: false
SANCTUM_STATEFUL_DOMAINS: localhost,localhost:80,localhost:8080
DB_CONNECTION: mariadb
DB_HOST: isop-database
DB_PORT: 3306
DB_DATABASE: isop
DB_USERNAME: root
DB_PASSWORD: admin
depends_on: depends_on:
database: isop-database:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
test: ["CMD", "pgrep", "-x", "php-fpm"] test: ["CMD", "pgrep", "-x", "php-fpm"]
@@ -64,8 +83,8 @@ services:
# MariaDB database # MariaDB database
# No ports are open, only Shopware itself has access # No ports are open, only Shopware itself has access
database: isop-database:
container_name: mariadb container_name: isop-database
image: mariadb:11.8.2-noble image: mariadb:11.8.2-noble
restart: unless-stopped restart: unless-stopped
cap_add: cap_add: