From d7fc14ebf31dbcc744d9af3ac10a0a4a7313c8df Mon Sep 17 00:00:00 2001 From: Aseer KT Date: Tue, 13 Aug 2024 09:07:25 +0530 Subject: [PATCH] chore: change web dist directory --- .github/workflows/ec2-cd.yml | 6 ------ Dockerfile | 2 +- infra/ec2/init.sh | 1 + server/src/index.ts | 2 +- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ec2-cd.yml b/.github/workflows/ec2-cd.yml index 150a3ad..3f5a181 100644 --- a/.github/workflows/ec2-cd.yml +++ b/.github/workflows/ec2-cd.yml @@ -53,12 +53,6 @@ jobs: uses: actions/download-artifact@v4 with: name: mchat_build - - - name: Move static files - run: | - sudo rm -rf server/web/dist/* - sudo mv web/dist/* server/web/dist - rm -rf server/src - name: Restart application run: pm2 restart mchat diff --git a/Dockerfile b/Dockerfile index 4b54278..cfba1d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ FROM base AS app WORKDIR /prod/app COPY --from=build /prod/server . -COPY --from=build /prod/web/dist ./web/dist +COPY --from=build /prod/web . RUN pnpm swag:gen diff --git a/infra/ec2/init.sh b/infra/ec2/init.sh index 76caf7a..6546249 100644 --- a/infra/ec2/init.sh +++ b/infra/ec2/init.sh @@ -50,5 +50,6 @@ cp ./Caddyfile /etc/caddy/Caddyfile ./docker-up.sh +# setup action runner # configure env file by hand # make pm2 available in github actions - https://stackoverflow.com/a/72030074/10240723 diff --git a/server/src/index.ts b/server/src/index.ts index 6bd5c36..edecdd7 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -76,7 +76,7 @@ const createApp = async () => { app.use(errorHandler) if (config.isProd) { - const webStaticPath = path.join(__dirname, '..', 'web', 'dist') + const webStaticPath = path.join(__dirname, '..', '..', 'web', 'dist') app.use(express.static(webStaticPath)) app.get('*', (_req, res) => { res.sendFile(path.join(webStaticPath, 'index.html'))