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.
This commit is contained in:
Oliver Davies 2021-07-08 09:00:00 +01:00
parent 94310ca1a5
commit 17626df722

View file

@ -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: