From db7c6838ea352399b8da11df459eb47c00a51a01 Mon Sep 17 00:00:00 2001 From: Kenny Cheng Date: Thu, 31 Oct 2024 14:29:33 +0800 Subject: [PATCH] update actions pipeline --- .github/workflows/nodejs.yml | 3 +++ Dockerfile | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index cde0dc2..c63175b 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -20,6 +20,9 @@ jobs: with: name: dist path: dist/ + pack: + runs-on: ubuntu-latest + steps: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx diff --git a/Dockerfile b/Dockerfile index e034153..776bcb4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,12 @@ +FROM node:current-alpine as build + +COPY . /app +WORKDIR /app + +RUN npm install && npm run build + ARG EXPRESS_REPO -FROM ${EXPRESS_REPO} +FROM ${EXPRESS_REPO} as runner -COPY dist/* /app/public/ +COPY --from=build /app/dist /app/public RUN sed -i 's/next(createError(404));/res.status(404).sendFile(path.join(__dirname, "public", "index.html"));/' /app/app.js \ No newline at end of file