custom-php/compose.yml

79 lines
2.3 KiB
YAML

version: "3.8"
services:
app:
image: php:${PHP_VERSION}-fpm-alpine3.13
volumes:
- "site_content:/var/www/html/"
networks:
- backend
- proxy
environment:
- PHP_EXTENSIONS
- APP_ENV
configs:
- source: php_uploads_conf
target: /usr/local/etc/php/conf.d/uploads.ini
- source: entrypoint_conf
target: /docker-entrypoint.sh
mode: 0555
entrypoint: /docker-entrypoint.sh
deploy:
update_config:
failure_action: rollback
order: start-first
labels:
- coop-cloud.${STACK_NAME}.app.version=${PHP_VERSION}-92fac7ac
frontend:
image: nginx:1.20-alpine
networks:
- proxy
depends_on:
- app
deploy:
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
# Redirect from EXTRA_DOMAINS to DOMAIN
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
- coop-cloud.${STACK_NAME}.frontend.version=1.20-c628b67d
volumes:
- site_content:/var/www/html/
configs:
- source: nginx_default_conf
target: /etc/nginx/conf.d/default.conf
environment:
- STACK_NAME
- ROOT_PATH
# healthcheck:
# test: ["CMD", "curl", "-f", "http://localhost"]
# interval: 30s
# timeout: 10s
# retries: 10
# start_period: 1m
networks:
backend:
# internal: true
proxy:
external: true
volumes:
site_content:
configs:
entrypoint_conf:
name: ${STACK_NAME}_entrypoint_conf_${ENTRYPOINT_CONF_VERSION}
file: entrypoint.sh.tmpl
template_driver: golang
nginx_default_conf:
name: ${STACK_NAME}_nginx_default_conf_${NGINX_DEFAULT_CONF_VERSION}
file: nginx.conf
template_driver: golang
php_uploads_conf:
name: ${STACK_NAME}_php_uploads_conf_${PHP_UPLOADS_CONF_VERSION}
file: uploads.ini