feat(docker): containerize sag24.ru — multi-stage Next.js build + nginx/php-fpm runtime

Single-container approach (nginx + php-fpm 8.3 + supervisord) to match web.hhivp.com
deployment paradigm (host nginx → docker по порту).

- Dockerfile: builder (node:22-alpine npm ci+next build) → runtime (php:8.3-fpm-alpine)
- docker/nginx.conf: serves static from /var/www/sag24.ru/public_html, fastcgi_pass на 127.0.0.1:9000
- docker/supervisord.conf: запускает php-fpm + nginx
- docker-compose.yml: для деплоя на web в /opt/docker/sites/sag24-ru/, mount contact-config.php read-only
- .dockerignore: исключает node_modules/.git/out из контекста

Container exposes :8080 (бесроутовый bind), маппится на host :4070 на web.
Watchtower label включён (auto-deploy на изменения образа в registry).
This commit is contained in:
2026-05-06 22:20:23 +03:00
parent ac0467290c
commit b2ca6d3ae7
5 changed files with 182 additions and 0 deletions

20
docker-compose.yml Normal file
View File

@@ -0,0 +1,20 @@
services:
sag24-ru:
image: registry.hhivp.com/striker/sag24-ru:latest
container_name: sag24-ru
restart: unless-stopped
ports:
- "127.0.0.1:4070:8080"
volumes:
# Секреты для контактной формы — вне образа, монтируется с хоста.
# На web путь: /opt/docker/sites/sag24-ru/secrets/contact-config.php
# contact.php ожидает файл по пути dirname(__DIR__, 2) == /var/www/sag24.ru
- ./secrets/contact-config.php:/var/www/sag24.ru/contact-config.php:ro
labels:
com.centurylinklabs.watchtower.enable: "true"
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8080/ru/"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s