From 82bb813eb19e1c2f3149ae0d1c9c9c37cd78ffcf Mon Sep 17 00:00:00 2001 From: Dantong Jin Date: Mon, 1 Sep 2025 15:45:10 +0800 Subject: [PATCH] fix: fix GH_TOKEN parsing problem in docker --- .env.example | 1 + .gitignore | 4 +++- Dockerfile | 8 ++++---- docker-compose.yml | 8 ++++++++ entrypoint.sh | 2 ++ 5 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 .env.example create mode 100644 docker-compose.yml create mode 100644 entrypoint.sh diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..6e237e5f --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +GH_TOKEN= diff --git a/.gitignore b/.gitignore index 577a4f19..73ebed92 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,6 @@ node_modules/ .eslintcache # build output -dist/ \ No newline at end of file +dist/ + +.env diff --git a/Dockerfile b/Dockerfile index 0d8f3d53..afee0003 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,8 +20,8 @@ EXPOSE 4141 HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ CMD wget --spider -q http://localhost:4141/ || exit 1 -ARG GH_TOKEN -ENV GH_TOKEN=$GH_TOKEN +COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT ["bun", "run", "dist/main.js"] -CMD ["start", "-g", "$GH_TOKEN"] +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..82b770db --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + copilot-api: + build: . + ports: + - "4141:4141" + environment: + - GH_TOKEN=${GH_TOKEN} + restart: unless-stopped diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 00000000..5a014945 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec bun run dist/main.js start -g "$GH_TOKEN"