From 17626df722408f32c2153e485296092675e23024 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 8 Jul 2021 09:00:00 +0100 Subject: [PATCH] Use Traefik as a local reverse proxy Use Traefik as a local reverse proxy so that the site can be accessed from http://oliverdavies.localhost rather than http://localhost:8000, which is the default for Sculpin. I've also overridden the command used for the app service so that it exposes port 80 and serves the site on that port, as well as configuring the URL to match within the generated output. --- docker-compose.yaml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index fc426e980..239f7973c 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,17 +1,40 @@ version: '2.4' services: + proxy: + image: traefik:v2.0-alpine + command: + - --api.insecure=true + - --providers.docker + volumes: + - /var/run/docker.sock:/var/run/docker.sock + ports: + - 80:80 + - 8080:8080 + labels: + - "traefik.enable=false" + app: build: context: . dockerfile: tools/docker/images/Dockerfile target: app + expose: + - 80 + command: + - generate + - --server + - --watch + - --port + - '80' + - --url + - oliverdavies.localhost volumes: - assets:/app/source/build - /app/output_dev - .:/app - ports: - - 8000:8000 + labels: + - "traefik.http.routers.oliverdavies.rule=Host(`oliverdavies.localhost`)" assets: image: node:14 @@ -28,6 +51,8 @@ services: - ./webpack.config.js:/node/webpack.config.js entrypoint: npm command: run watch + labels: + - "traefik.enable=false" volumes: assets: