homepage/docker-compose.yml
surtur 573c9da829
All checks were successful
continuous-integration/drone/pr Build is passing
embed homepage in a Go app
the entire './public' folder that Hugo produces is embedded into a
variable of 'embed.FS' type and served directly using the default http
mux that Go std offers.

ci, pre-commit, Dockerfile and compose file have all been updated
accordingly.

nginx is no longer needed to front the site files, which enabled
switching to a SCRATCH image containing just a single statically linked
"homepage" app that has all files (html, css, js) embedded.
the containers are otherwise empty (as the name SCRATCH suggests), which
further decreases potential attack surface area.
2022-08-08 14:54:30 +02:00

55 lines
1.8 KiB
YAML

---
version: '3'
services:
reverse-proxy:
image: traefik:2.8.1
command: --api=false --api.dashboard=false --providers.docker
mem_limit: 64m
networks:
- internal-nw
- default
ports:
- 127.0.0.1:1314:1314
restart: always
volumes:
# So that traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock:ro
homepage:
build:
context: .
image: homepage
mem_limit: 8m
networks:
- internal-nw
restart: always
labels:
- traefik.enable=true
- traefik.http.services.homepage.loadbalancer.server.port=1314
- traefik.http.routers.homepage.rule=Host(`localhost`) || Host(`127.0.0.1`) || Host(`homepage`) || Host(`6426tqrh4y5uobmo5y2csaip3m3avmjegd2kpa24sadekpxglbm34aqd.onion`)
# ref: https://stackoverflow.com/a/61976953
# ref: https://github.com/traefik/traefik/issues/563
- "traefik.http.routers.homepage.middlewares=homepage-redirectregex, homepage-replacepathregex"
- "traefik.http.middlewares.homepage-replacepathregex.replacepathregex.regex=^/tags/(.*)$$"
- "traefik.http.middlewares.homepage-replacepathregex.replacepathregex.replacement=https://dotya.ml/tags/$$1/"
- "traefik.http.middlewares.homepage-redirectregex.redirectregex.regex=^/tags$$"
- "traefik.http.middlewares.homepage-redirectregex.redirectregex.replacement=https://dotya.ml/tags/"
- "traefik.frontend.redirect.regex=^https://dotya.ml/tags/(.*)$$"
- "traefik.frontend.redirect.replacement=https://dotya.ml/tags/$$1/"
- "traefik.frontend.rule=PathPrefix:/tags;ReplacePathRegex: ^/tags/(.*) /tags/$$1/"
logging:
driver: json-file
options:
max-size: "5m"
max-file: "5"
networks:
internal-nw:
internal: true
default:
...