From 913f0fbc51573d2068c7542c60e64dd9beb00251 Mon Sep 17 00:00:00 2001 From: Jufeng Zhang Date: Sun, 17 Sep 2023 16:57:36 +0800 Subject: [PATCH] fix: node:18-alpine git --- .env | 6 ++++++ .github/workflows/docker.yml | 7 ++++++- Dockerfile | 3 +++ docker-compose.dev.yml | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.env b/.env index 822673a..3a3b4a3 100644 --- a/.env +++ b/.env @@ -1,6 +1,7 @@ NODE_LOCAL_PORT=30001 NODE_DOCKER_PORT=30001 +# TODO: docker MongoDB Replica Set MONGODB_URI=mongodb://mongodb:27017/dochub?directConnection=true MONGODB_LOCAL_PORT=27017 MONGODB_DOCKER_PORT=27017 @@ -10,3 +11,8 @@ SECRET=DO NOT USE THIS VALUE. INSTEAD, CREATE A COMPLEX SECRET AND KEEP IT SAFE GITHUB_CLIENT_ID=your github client id GITHUB_CLIENT_SECRET=your github client secret GITHUB_CALL_BACK_URL=http://127.0.0.1:3001/api/auth/github/callback + +# development local MongoDB MONGODB_URI +# MONGODB_URI=mongodb://127.0.0.1:27017/dochub?directConnection=true +# Docker development local MongoDB MONGODB_URI +# MONGODB_URI=mongodb://host.docker.internal:27017/dochub?directConnection=true \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7c3f058..793a2ff 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -41,4 +41,9 @@ jobs: sudo docker pull zjffun/dochub-server sudo docker stop dochub-server sudo docker remove dochub-server - sudo docker run -e DOTENV_KEY="${{ secrets.DOTENV_KEY }}" -d --restart=always --name dochub-server -p 30001:30001 zjffun/dochub-server:latest + sudo docker run --name dochub-server\ + -e DOTENV_KEY="${{ secrets.DOTENV_KEY }}"\ + -p 30001:30001\ + -v /usr/share/com.zjffun.dochub:/usr/share/com.zjffun.dochub\ + -d --restart=always\ + zjffun/dochub-server:latest diff --git a/Dockerfile b/Dockerfile index 7f27721..3b5a20e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,4 +50,7 @@ COPY --chown=node:node .env.vault ./ COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules COPY --chown=node:node --from=build /usr/src/app/dist ./dist +RUN apk add git +RUN git init + CMD [ "node", "dist/main.js" ] diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index a2da866..5bb99fe 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -29,6 +29,7 @@ services: - .:/usr/src/app # Prevents node_modules from being overwritten by the container - /usr/src/app/node_modules + - /usr/share/com.zjffun.dochub:/usr/share/com.zjffun.dochub volumes: db: