From 55e7e71aa21af322f19a8e57495b2b808fcd42e3 Mon Sep 17 00:00:00 2001 From: Kenny Cheng Date: Thu, 31 Oct 2024 14:09:09 +0800 Subject: [PATCH] add docker build actions --- .github/workflows/nodejs.yml | 17 +++++++++++++++++ Dockerfile | 5 +++++ 2 files changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 3164d7b..6bbba72 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -20,3 +20,20 @@ jobs: with: name: dist path: dist/ + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{ secrets.KENNYSDOCKER_REGISTRY }} + username: ${{ secrets.KENNYSDOCKER_REGISTRY_USERNAME }} + password: ${{ secrets.KENNYSDOCKER_REGISTRY_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ secrets.KENNYSDOCKER_REGISTRY }}/comp3047-fall2024/vue:${{ github.event.repository.name }} + env: + EXPRESS_REPO: ${{ secrets.COMP3047_FALL2024_EXPRESS_REPO }}${{ github.actor }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e034153 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +ARG EXPRESS_REPO +FROM ${EXPRESS_REPO} + +COPY 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