86 lines
2.2 KiB
YAML
86 lines
2.2 KiB
YAML
# Docker stack for "Kehadiran Taklimat SPR" (Laravel 13 / PHP 8.4)
|
|
#
|
|
# Topology:
|
|
# web (nginx) -> exposes 127.0.0.1:8080, host nginx reverse-proxies the
|
|
# domain http://taklimatspr.apps.mbip.my to it.
|
|
# app (fpm) -> PHP 8.4-FPM, runs migrations on boot.
|
|
# queue -> database queue worker.
|
|
# scheduler -> Laravel scheduler.
|
|
#
|
|
# Databases (sppm_taklimat + the existing sppm DB) live on the HOST MySQL and
|
|
# are reached via host.docker.internal (see extra_hosts below + DOCKER.md).
|
|
|
|
x-app-build: &app-build
|
|
context: .
|
|
dockerfile: docker/Dockerfile
|
|
target: app
|
|
|
|
x-app-common: &app-common
|
|
build: *app-build
|
|
image: taklimatspr-app:latest
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env.docker
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
volumes:
|
|
- app_storage:/var/www/html/storage
|
|
|
|
services:
|
|
app:
|
|
<<: *app-common
|
|
environment:
|
|
RUN_MIGRATIONS: "true"
|
|
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/Dockerfile
|
|
target: web
|
|
image: taklimatspr-web:latest
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- app
|
|
ports:
|
|
# Bind to loopback only; the host nginx terminates the public domain.
|
|
- "127.0.0.1:8008:80"
|
|
|
|
queue:
|
|
<<: *app-common
|
|
environment:
|
|
RUN_MIGRATIONS: "false"
|
|
command: php artisan queue:work --sleep=3 --tries=3 --max-time=3600
|
|
depends_on:
|
|
- app
|
|
|
|
scheduler:
|
|
<<: *app-common
|
|
environment:
|
|
RUN_MIGRATIONS: "false"
|
|
command: php artisan schedule:work
|
|
depends_on:
|
|
- app
|
|
|
|
# Webhook deploy (GitHub push -> git pull + rebuild). Dengar 127.0.0.1:9001;
|
|
# host nginx reverse-proxy /hooks/ ke sini. WEBHOOK_SECRET dari .env.docker.
|
|
webhook:
|
|
build:
|
|
context: ./docker/webhook
|
|
image: taklimatspr-webhook:latest
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env.docker
|
|
ports:
|
|
- "127.0.0.1:9001:9000"
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
- ./docker/webhook/hooks.json:/etc/webhook/hooks.json:ro
|
|
- ./deploy.sh:/deploy.sh:ro
|
|
- .:/srv/spr2026_taklimat
|
|
# Kunci SSH host utk `git pull` repo peribadi (abaikan jika repo awam/HTTPS).
|
|
- /root/.ssh:/root/.ssh:ro
|
|
command: -hooks=/etc/webhook/hooks.json -hotreload -verbose
|
|
|
|
volumes:
|
|
app_storage:
|