feat: add basic Docker configuration for backend and frontend services

This commit is contained in:
2025-10-28 12:28:11 +01:00
parent 7cf72fec7b
commit 79a8c4f229
6 changed files with 224 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
.Caddyfile
caddy-data/
caddy-config/
mariadb_data/
+24
View File
@@ -0,0 +1,24 @@
# Leave this section
{
admin off
}
http://localhost {
root * /app/public
encode zstd gzip
php_fastcgi php-fpm:9000
@laravel_not_found {
not file
not path /index.php*
}
rewrite @laravel_not_found /index.php
file_server
}
# Leave this section
http://localhost:2019 {
metrics /metrics
}
+86
View File
@@ -0,0 +1,86 @@
services:
node:
container_name: node
build:
context: ../frontend
dockerfile: Dockerfile
restart: unless-stopped
depends_on:
php-fpm:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost"]
start_period: 10s
interval: 1m
timeout: 5s
retries: 5
# Caddy webserver
caddy:
container_name: caddy
image: caddy:2.10.0-alpine
restart: unless-stopped
ports:
- 80:80 # Needed for HTTP->HTTPS redirection
- 443:443
- 443:443/udp
volumes:
# Caddy routes files (read-only)
- ./Caddyfile:/etc/caddy/Caddyfile:ro
# Caddy certificates and other temporary data
- ./caddy-data:/data
# Caddy configuration
- ./caddy-config:/config
depends_on:
- php-fpm
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:2019/metrics"]
start_period: 10s
interval: 1m
timeout: 5s
retries: 5
# Custom PHP container
php-fpm:
container_name: php-fpm
user: 'www-data:www-data'
build:
context: ../backend
dockerfile: Dockerfile
restart: unless-stopped
env_file:
- ../backend/.env
depends_on:
database:
condition: service_healthy
healthcheck:
test: ["CMD", "pgrep", "-x", "php-fpm"]
start_period: 10s
interval: 1m
timeout: 5s
retries: 5
# MariaDB database
# No ports are open, only Shopware itself has access
database:
container_name: mariadb
image: mariadb:11.8.2-noble
restart: unless-stopped
cap_add:
# Allow memory binding
- SYS_NICE
environment:
# Change these if needed
MARIADB_DATABASE: "isop"
MARIADB_ROOT_PASSWORD: "admin"
volumes:
# Database data
- ./mariadb_data:/var/lib/mysql
healthcheck:
test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized" ]
start_period: 10s
interval: 1m
timeout: 5s
retries: 3