chore: add traefik

This commit is contained in:
xfy
2024-11-12 16:15:21 +08:00
parent e1c34c99c1
commit 726fbcc9af
2 changed files with 23 additions and 1 deletions

View File

@ -1,6 +1,5 @@
FROM node:lts-alpine AS base
# Install dependencies only when needed
FROM base AS deps
WORKDIR /app
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.

23
compose.yaml Normal file
View File

@ -0,0 +1,23 @@
services:
reverse-proxy:
image: traefik
command:
- --api.insecure=true
- --providers.docker
- --entrypoints.app.address=:80
ports:
- '8021:80'
# The Web UI (enabled by --api.insecure=true)
- '8022:8080'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
app:
build: .
labels:
- 'traefik.http.routers.app.rule=PathPrefix(`/`)'
- 'traefik.http.services.app.loadbalancer.server.port=3000'
deploy:
replicas: 3
ports:
- 3000