Skip to content

Commit

Permalink
feat: apply traefik to compose labels
Browse files Browse the repository at this point in the history
  • Loading branch information
geoje committed Nov 18, 2024
1 parent 00013a9 commit 4e8f694
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
22 changes: 15 additions & 7 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ services:
restart: unless-stopped
volumes:
- ./frontend/dist:/usr/share/nginx/html
entrypoint:
- sh
- -euc
- |
grep -q 'try_files /$$uri /index.html;' /etc/nginx/conf.d/default.conf ||
sed -i '/location \/ {/a try_files $$uri \/index.html;' /etc/nginx/conf.d/default.conf
nginx -g 'daemon off;'
- ./frontend/nginx.conf:/etc/nginx/conf.d/default.conf
labels:
- traefik.enable=true
- traefik.http.services.mapletool-fe.loadbalancer.server.port=80
- traefik.http.routers.mapletool-fe.rule=Host(`maple.ygh.kr`)
- traefik.http.routers.mapletool-fe.entrypoints=websecure
- traefik.http.routers.mapletool-fe.tls=true
- traefik.http.routers.mapletool-fe.tls.certresolver=letsencrypt

be:
image: openjdk:21-jdk-slim
Expand All @@ -32,6 +33,13 @@ services:
- db
volumes:
- ./backend/build/libs:/opt
labels:
- traefik.enable=true
- traefik.http.services.mapletool-be.loadbalancer.server.port=8080
- traefik.http.routers.mapletool-be.rule=Host(`maple.ygh.kr`) && PathPrefix(`/api`)
- traefik.http.routers.mapletool-be.entrypoints=websecure
- traefik.http.routers.mapletool-be.tls=true
- traefik.http.routers.mapletool-be.tls.certresolver=letsencrypt
working_dir: /opt
entrypoint: ["java", "-jar", "mapletool.jar"]

Expand Down
10 changes: 10 additions & 0 deletions frontend/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;

location / {
try_files $uri /index.html;
index index.html;
}
}

0 comments on commit 4e8f694

Please sign in to comment.