-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
66 lines (64 loc) · 2.06 KB
/
Copy pathdocker-compose.yml
File metadata and controls
66 lines (64 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
services:
generate-certs:
image: alpine:latest
entrypoint: /bin/sh
command:
- -c
- |
if [ -f /certs/traefik.crt ] && [ -f /certs/traefik.key ]; then
echo "Certificates already exist, skipping."
exit 0
fi
apk add --no-cache openssl
SAN="DNS:localhost,IP:127.0.0.1"
for ip in $$(hostname -I 2>/dev/null); do SAN="$$SAN,IP:$$ip"; done
echo "Generating certificate with SAN: $$SAN"
openssl req -x509 -nodes -days 3650 \
-newkey rsa:2048 \
-keyout /certs/traefik.key \
-out /certs/traefik.crt \
-subj "/CN=leapconnect" \
-addext "subjectAltName=$$SAN"
echo "Done."
volumes:
- ./traefik/certs:/certs
network_mode: host
traefik:
image: traefik:latest
depends_on:
generate-certs:
condition: service_completed_successfully
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--providers.file.filename=/etc/traefik/dynamic.yml"
ports:
- "80:80"
- "443:443"
# - "8080:8080" # Traefik dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik/dynamic.yml:/etc/traefik/dynamic.yml:ro
- ./traefik/certs:/certs:ro
restart: unless-stopped
app:
build:
context: .
dockerfile: Dockerfile
environment:
- DB_PATH=/app/data/leapconnect.db
- DATA_DIR=/app/data
volumes:
- ./data:/app/data
labels:
- "traefik.enable=true"
- "traefik.http.routers.leapmotor.rule=PathPrefix(`/`)"
- "traefik.http.routers.leapmotor.entrypoints=websecure"
- "traefik.http.routers.leapmotor.tls=true"
- "traefik.http.services.leapmotor.loadbalancer.server.port=8099"
restart: unless-stopped