Use a proxy within the Compose file

This commit is contained in:
Oliver Davies 2021-04-16 13:16:07 +01:00
parent 9d6c6cd758
commit 0ce7a8014c
2 changed files with 10 additions and 23 deletions

View file

@ -3,12 +3,14 @@ version: '2.4'
volumes: volumes:
mysql_data: mysql_data:
networks:
web:
external:
name: traefik_proxy
services: services:
proxy:
image: jwilder/nginx-proxy
ports:
- 80:80
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
nginx: nginx:
image: nginx:1-alpine image: nginx:1-alpine
working_dir: /app working_dir: /app
@ -20,13 +22,8 @@ services:
condition: service_started condition: service_started
php: php:
condition: service_started condition: service_started
networks: environment:
default: {} VIRTUAL_HOST: oliverdavies.localhost
web: {}
labels:
- traefik.docker.network=traefik_proxy
- traefik.enable=true
- traefik.http.routers.oliverdavies.rule=Host(`oliverdavies.docker.localhost`)
php: php:
build: build:
@ -40,10 +37,6 @@ services:
depends_on: depends_on:
mysql: mysql:
condition: service_healthy condition: service_healthy
networks:
default: {}
labels:
- "traefik.enable=false"
mysql: mysql:
image: mariadb:10 image: mariadb:10
@ -55,15 +48,9 @@ services:
healthcheck: healthcheck:
test: ["CMD-SHELL", "bash", "-c", "echo > /dev/tcp/localhost/3306"] test: ["CMD-SHELL", "bash", "-c", "echo > /dev/tcp/localhost/3306"]
interval: 1s interval: 1s
networks:
default: {}
labels:
- "traefik.enable=false"
node: node:
image: node:12 image: node:12
working_dir: /node working_dir: /node
volumes: volumes:
- ./web:/node - ./web:/node
labels:
- "traefik.enabled=false"

View file

@ -12,5 +12,5 @@ $databases['default']['default'] = [
]; ];
$settings['trusted_host_patterns'] = [ $settings['trusted_host_patterns'] = [
'^oliverdavies.docker.localhost$', '^oliverdavies.localhost$',
]; ];