From 82543fc2f7a2e1c0c6808f4a7be6ef49c2f43258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B3=E5=85=83=E7=9A=93?= Date: Sun, 11 May 2025 18:09:41 +0800 Subject: [PATCH] Switch to working docker-compose for deployments --- docker-compose.yml | 42 ++++++++++++++---------------------------- new-docker-compose.yml | 29 +++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 28 deletions(-) create mode 100755 new-docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml index 0063c38..15df6e2 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,29 +1,15 @@ -services: - internal-proxy: - image: traefik:latest - command: - - --entrypoints.webinternal.address=:80 - ports: - - "127.0.0.1:36694:80" - volumes: - - /var/run/docker.sock:/var/run/docker.sock:ro - networks: - - app-network - newsanalyze-service: - build: . - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:3000/health"] - interval: 1m - timeout: 10s - retries: 3 - networks: - - app-network - labels: - - "traefik.enable=true" - - "traefik.http.routers.newsanalyze.rule=Host(`news.yuanhau.com`)" - - "traefik.http.routers.newsanalyze.entrypoints=webinternal" - - "traefik.http.services.newsanalyze.loadbalancer.server.port=3000" +version: '3.8' -networks: - app-network: - driver: bridge +services: + newsanalyze-service: + build: . + ports: + - "127.0.0.1:36694:3000" + environment: + - NODE_ENV=production + restart: unless-stopped + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000"] + interval: 30s + timeout: 10s + retries: 3 \ No newline at end of file diff --git a/new-docker-compose.yml b/new-docker-compose.yml new file mode 100755 index 0000000..0063c38 --- /dev/null +++ b/new-docker-compose.yml @@ -0,0 +1,29 @@ +services: + internal-proxy: + image: traefik:latest + command: + - --entrypoints.webinternal.address=:80 + ports: + - "127.0.0.1:36694:80" + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + networks: + - app-network + newsanalyze-service: + build: . + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000/health"] + interval: 1m + timeout: 10s + retries: 3 + networks: + - app-network + labels: + - "traefik.enable=true" + - "traefik.http.routers.newsanalyze.rule=Host(`news.yuanhau.com`)" + - "traefik.http.routers.newsanalyze.entrypoints=webinternal" + - "traefik.http.services.newsanalyze.loadbalancer.server.port=3000" + +networks: + app-network: + driver: bridge