From caf3ec524dc103c70e556b2b1eed80d496e4e7ea Mon Sep 17 00:00:00 2001 From: suhjae Date: Tue, 3 Sep 2024 09:00:16 +0900 Subject: [PATCH] xig: deploy --- .github/workflows/deploy.yml | 2 +- Dockerfile | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6561380..3a784cf 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,7 +23,7 @@ jobs: - name: Deploy to server run: | - ssh ${{ secrets.USER }}@${{ secrets.SERVER_IP }} << 'ENDSSH' + ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} << 'ENDSSH' cd ${{ secrets.SERVER_DEPLOY_PATH }} git pull origin main docker stop ${{ secrets.APP_NAME }} || true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eb5100e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +ARG NODE_VERSION=22.5.1 + +FROM node:${NODE_VERSION}-slim as base + +ARG PORT=3000 + +ENV NODE_ENV=production + +WORKDIR /src + +# Build +FROM base as build + +COPY --link package.json package-lock.json ./ +RUN npm install --production=false + +COPY --link . . + +RUN npm run build +RUN npm prune + +# Run +FROM base + +ENV PORT=$PORT + +COPY --from=build /src/.output /src/.output +# Optional, only needed if you rely on unbundled dependencies +# COPY --from=build /src/node_modules /src/node_modules + +CMD [ "node", ".output/server/index.mjs" ]