1+ services :
2+
3+ # https://github.com/Tob1as/docker-php
4+ # based on: https://dhi.io/catalog/php
5+ # command: mkdir ./html && chown 65532:65532 ./html
6+ wsc-php :
7+ image : docker.io/tobi312/php:8.4-dhi-fpm-debian-wsc
8+ # image: docker.io/tobi312/php:8.4-dhi-fpm-alpine-wsc
9+ container_name : wsc-php
10+ restart : unless-stopped
11+ volumes :
12+ - ./html:/var/www/html:rw
13+ # depends_on:
14+ # wsc-db:
15+ # condition: service_started
16+ networks :
17+ - wsc-net
18+
19+ # https://dhi.io/catalog/nginx
20+ wsc-nginx :
21+ image : dhi.io/nginx:1.29-debian13
22+ container_name : wsc-nginx
23+ restart : unless-stopped
24+ # ports:
25+ # - "80:8080"
26+ volumes :
27+ - ./html:/var/www/html:rw
28+ - ./config/nginx_default.conf:/etc/nginx/conf.d/default.conf:ro
29+ depends_on :
30+ wsc-php :
31+ condition : service_started
32+ networks :
33+ - wsc-net
34+ - traefik
35+ labels :
36+ # Explicitly tell Traefik to expose this container
37+ - " traefik.enable=true"
38+ - " traefik.docker.network=traefik"
39+ # Tell Traefik to use the http port 8080 to connect to container
40+ - " traefik.http.services.wsc.loadbalancer.server.port=8080"
41+ - " traefik.http.services.wsc.loadbalancer.server.scheme=http" # when "https" then set "--serversTransport.insecureSkipVerify=true" for traefik
42+ # http
43+ - " traefik.http.routers.wsc-http.rule=Host(`${DOMAIN}`)"
44+ - " traefik.http.routers.wsc-http.entrypoints=web"
45+ - " traefik.http.routers.wsc-http.service=wsc"
46+ # https
47+ - " traefik.http.routers.wsc-https.tls=true"
48+ - " traefik.http.routers.wsc-https.rule=Host(`${DOMAIN}`)"
49+ - " traefik.http.routers.wsc-https.entrypoints=websecure"
50+ - " traefik.http.routers.wsc-https.service=wsc"
51+ # load middlewares for routes
52+ - " traefik.http.routers.wsc-http.middlewares=wsc-https"
53+ # - "traefik.http.routers.wsc-https.middlewares="
54+ # http to https redirect
55+ - " traefik.http.middlewares.wsc-https.redirectscheme.scheme=https"
56+ - " traefik.http.middlewares.wsc-https.redirectscheme.permanent=true"
57+ # - "traefik.http.middlewares.wsc-https.redirectscheme.port=443"
58+
59+ # https://dhi.io/catalog/mysql
60+ # command: mkdir ./data-db && chown 65532:65532 ./data-db
61+ wsc-db :
62+ image : dhi.io/mysql:8.4-debian13
63+ container_name : wsc-db
64+ restart : unless-stopped
65+ volumes :
66+ - ./data-db:/var/lib/mysql:rw
67+ environment :
68+ MYSQL_ROOT_PASSWORD : " ${MYSQL_ROOT_PASSWORD}"
69+ # only support in DHI (instead of own *.cnf file)
70+ MYSQL_OPTIONS : " --innodb-buffer-pool-size=512M"
71+ # not supported in DHI, but for commands to create database and user
72+ MYSQL_DATABASE : " ${MYSQL_DATABASE}"
73+ MYSQL_USER : " ${MYSQL_USER}"
74+ MYSQL_PASSWORD : " ${MYSQL_PASSWORD}"
75+ # ports:
76+ # - 127.0.0.1:3060:3306/tcp
77+ # - 127.0.0.1:33060:33060/tcp
78+ networks :
79+ wsc-net :
80+ aliases :
81+ - wsc-database
82+ - wsc-mysql
83+ - wsc-mariadb
84+ # TODO: only do this commands after first start when using dhi mysql image (create database and user with password form environment vars):
85+ # docker exec -it wsc-mysql bash -c 'mysql -uroot -e "CREATE DATABASE ${MYSQL_DATABASE};"'
86+ # docker exec -it wsc-mysql bash -c 'mysql -uroot -e "CREATE USER \"${MYSQL_USER}\"@\"%\" IDENTIFIED BY \"${MYSQL_PASSWORD}\"; GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE}.* TO \"${MYSQL_USER}\"@\"%\";"'
87+
88+
89+ networks :
90+ wsc-net :
91+ name : wsc-net
92+ traefik :
93+ name : traefik
94+ external : true
0 commit comments