From d8d2cb2b0cec53dbb4f56155215063122399c9f3 Mon Sep 17 00:00:00 2001 From: droak Date: Sun, 23 Jun 2024 14:59:44 +0900 Subject: [PATCH 1/2] add dockerfile and docker compose --- docker-compose.yml | 25 +++++++++++++++++++++++++ packages/node/Dockerfile | 8 ++++++++ packages/node/entrypoint.sh | 3 +++ packages/node/package.json | 9 +++------ 4 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 docker-compose.yml create mode 100644 packages/node/Dockerfile create mode 100644 packages/node/entrypoint.sh diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..f0609a96 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +services: + proxy: + image: valian/docker-nginx-auto-ssl + # restart: on-failure + ports: + - 80:80 + - 443:443 + volumes: + - ssl_data:/etc/resty-auto-ssl + environment: + FORCE_HTTPS: true + SITES: relay.domain.com=relay:50000 + depends_on: + - relay + + relay: + build: + context: packages/node + dockerfile: Dockerfile + ports: + - 50000:50000 + command: relay + +volumes: + ssl_data: diff --git a/packages/node/Dockerfile b/packages/node/Dockerfile new file mode 100644 index 00000000..1f4bd908 --- /dev/null +++ b/packages/node/Dockerfile @@ -0,0 +1,8 @@ +FROM node:22.3-bookworm-slim + +WORKDIR /node +COPY . . + +RUN chmod +x /node/entrypoint.sh + +ENTRYPOINT ["/bin/bash", "/node/entrypoint.sh"] diff --git a/packages/node/entrypoint.sh b/packages/node/entrypoint.sh new file mode 100644 index 00000000..15ea7051 --- /dev/null +++ b/packages/node/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash +yarn +exec yarn run "$@" diff --git a/packages/node/package.json b/packages/node/package.json index 4ef64aae..daa45b76 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -8,12 +8,7 @@ }, "type": "module", "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], + "files": ["src", "dist", "!dist/test", "!**/*.tsbuildinfo"], "exports": { ".": { "types": "./dist/src/index.d.ts", @@ -30,7 +25,9 @@ "test": "vitest" }, "devDependencies": { + "@types/node": "^20.14.2", "tsx": "^4.15.6", + "typescript": "^5.4.5", "vitest": "^1.6.0" }, "dependencies": { From d2f188e655a23e1e67953955915ad887f013231b Mon Sep 17 00:00:00 2001 From: droak Date: Sun, 23 Jun 2024 15:00:57 +0900 Subject: [PATCH 2/2] add restart on-failure for the proxy --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index f0609a96..4fd21b73 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: proxy: image: valian/docker-nginx-auto-ssl - # restart: on-failure + restart: on-failure ports: - 80:80 - 443:443