Created
December 11, 2023 15:54
-
-
Save nickbasile/41abb4b24141b4c2c309dfd580385ff5 to your computer and use it in GitHub Desktop.
Docker set up
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
traefik: | |
restart: "no" | |
networks: | |
development: | |
aliases: | |
- <project-name>.dev.test | |
ports: | |
- 80:80 | |
- 443:443 | |
- 8080:8080 | |
volumes: | |
# Add Docker as a mounted volume, so that Traefik can read the labels of other services | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
- ./.infrastructure/conf/traefik/dev/traefik.yml:/traefik.yml:ro | |
- ./.infrastructure/conf/traefik/dev/traefik-certs.yml:/traefik-certs.yml | |
- ./.infrastructure/conf/traefik/dev/certificates/:/certificates | |
mysql: | |
image: mysql:5.7 | |
platform: linux/x86_64 | |
networks: | |
- development | |
volumes: | |
- ./.infrastructure/volume_data/mysql/database_data/:/var/lib/mysql | |
- ./.infrastructure/conf/mysql/dev/01.sql:/docker-entrypoint-initdb.d/init.sql | |
environment: | |
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' | |
MYSQL_ROOT_HOST: '%' | |
MYSQL_DATABASE: '${DB_DATABASE}' | |
MYSQL_USER: '${DB_USERNAME}' | |
MYSQL_PASSWORD: '${DB_PASSWORD}' | |
MYSQL_ALLOW_EMPTY_PASSWORD: 1 | |
ports: | |
- 3306:3306 | |
php: | |
build: | |
target: development | |
volumes: | |
- .:/var/www/html/ | |
networks: | |
- development | |
labels: | |
- "traefik.enable=true" | |
- "traefik.http.routers.<project-name>.rule=Host(`<project-name>.dev.test`)" | |
- "traefik.http.routers.<project-name>.entrypoints=websecure" | |
- "traefik.http.routers.<project-name>.tls=true" | |
- "traefik.http.services.<project-name>.loadbalancer.server.port=443" | |
- "traefik.http.services.<project-name>.loadbalancer.server.scheme=https" | |
- "traefik.docker.network=development" | |
# # 🔥 Uncomment for debugging | |
environment: | |
LOG_LEVEL: "debug" | |
AUTORUN_ENABLED: "false" | |
networks: | |
development: | |
driver: bridge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
traefik: | |
image: traefik:v2.10 | |
php: | |
build: | |
context: . | |
dockerfile: Dockerfile | |
working_dir: /var/www/html | |
depends_on: | |
- traefik | |
- mysql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM serversideup/php:beta-8.2-fpm-nginx as base | |
### Development | |
FROM base as development | |
### Deploy | |
FROM base as deploy | |
LABEL maintainer="<project-owner>" | |
COPY --chown=www-data:www-data . /var/www/html | |
EXPOSE 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment