Files
hoshpoint-backend/docker-compose.yml

142 lines
3.7 KiB
YAML

x-build-args: &build-args
DOCKER_REGISTRY: ${DOCKER_REGISTRY:-docker.arvancloud.ir}
HTTP_PROXY: ${DOCKER_BUILD_HTTP_PROXY:-}
HTTPS_PROXY: ${DOCKER_BUILD_HTTPS_PROXY:-${DOCKER_BUILD_HTTP_PROXY:-}}
NO_PROXY: ${DOCKER_BUILD_NO_PROXY:-localhost,127.0.0.1,::1}
http_proxy: ${DOCKER_BUILD_HTTP_PROXY:-}
https_proxy: ${DOCKER_BUILD_HTTPS_PROXY:-${DOCKER_BUILD_HTTP_PROXY:-}}
no_proxy: ${DOCKER_BUILD_NO_PROXY:-localhost,127.0.0.1,::1}
DEBIAN_APT_MIRROR: ${DEBIAN_APT_MIRROR:-}
DEBIAN_SECURITY_APT_MIRROR: ${DEBIAN_SECURITY_APT_MIRROR:-}
DEBIAN_APT_DISABLE_UPDATES: ${DEBIAN_APT_DISABLE_UPDATES:-}
x-app-proxy-environment: &app-proxy-environment
HTTP_PROXY: ${APP_HTTP_PROXY:-}
HTTPS_PROXY: ${APP_HTTPS_PROXY:-${APP_HTTP_PROXY:-}}
NO_PROXY: ${APP_NO_PROXY:-localhost,127.0.0.1,::1,mariadb,nginx,app,queue,scheduler,vless-proxy}
services:
vless-proxy:
image: ${XRAY_IMAGE:-ghcr.io/xtls/xray-core:latest}
restart: unless-stopped
profiles:
- proxy
command: ["run", "-config", "/usr/local/etc/xray/config.json"]
volumes:
- type: bind
source: ${XRAY_CONFIG_FILE:-./docker/xray/config.local.json}
target: /usr/local/etc/xray/config.json
read_only: true
bind:
create_host_path: false
ports:
- "127.0.0.1:${VLESS_PROXY_HTTP_PORT:-2080}:8080"
- "127.0.0.1:${VLESS_PROXY_SOCKS_PORT:-2081}:1080"
networks:
- hoshpoint
app:
build:
context: .
target: app
args: *build-args
image: hoshpoint-backend-app:production
restart: unless-stopped
env_file:
- ${APP_ENV_FILE:-.env.production}
environment:
<<: *app-proxy-environment
APP_ENV: production
APP_DEBUG: "false"
LOG_CHANNEL: stderr
DB_HOST: mariadb
DB_PORT: 3306
depends_on:
mariadb:
condition: service_healthy
volumes:
- app-storage:/var/www/html/storage
networks:
- hoshpoint
nginx:
build:
context: .
target: nginx
args: *build-args
image: hoshpoint-backend-nginx:production
restart: unless-stopped
depends_on:
- app
ports:
- "${HTTP_PORT:-8080}:80"
volumes:
- app-storage:/var/www/html/storage:ro
networks:
- hoshpoint
queue:
image: hoshpoint-backend-app:production
restart: unless-stopped
env_file:
- ${APP_ENV_FILE:-.env.production}
environment:
<<: *app-proxy-environment
APP_ENV: production
APP_DEBUG: "false"
LOG_CHANNEL: stderr
DB_HOST: mariadb
DB_PORT: 3306
command: php artisan queue:work database --sleep=3 --tries=3 --timeout=90
depends_on:
mariadb:
condition: service_healthy
volumes:
- app-storage:/var/www/html/storage
networks:
- hoshpoint
scheduler:
image: hoshpoint-backend-app:production
restart: unless-stopped
env_file:
- ${APP_ENV_FILE:-.env.production}
environment:
<<: *app-proxy-environment
APP_ENV: production
APP_DEBUG: "false"
LOG_CHANNEL: stderr
DB_HOST: mariadb
DB_PORT: 3306
command: sh -c "while true; do php artisan schedule:run --no-interaction; sleep 60; done"
depends_on:
mariadb:
condition: service_healthy
volumes:
- app-storage:/var/www/html/storage
networks:
- hoshpoint
mariadb:
image: mariadb:11.4
restart: unless-stopped
env_file:
- ${APP_ENV_FILE:-.env.production}
volumes:
- mariadb-data:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 5
networks:
- hoshpoint
volumes:
app-storage:
mariadb-data:
networks:
hoshpoint:
driver: bridge