From e98ec053cd3da7fe67897febab75412338cad648 Mon Sep 17 00:00:00 2001 From: Mario Apra Date: Thu, 19 Dec 2024 23:55:53 +0000 Subject: [PATCH] feat: Add workflow for building dashboard image Creates a new GitHub Actions workflow to build and push the dashboard Docker image on pushes to the main branch. Adds Dockerfile for the dashboard to define the build process. Benefits include automated builds and consistent deployment of the dashboard container. --- .github/workflows/push-dashboard-image.yml | 47 ++++++++++++++++++++++ dashboard/Dockerfile | 9 +++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/push-dashboard-image.yml create mode 100644 dashboard/Dockerfile diff --git a/.github/workflows/push-dashboard-image.yml b/.github/workflows/push-dashboard-image.yml new file mode 100644 index 00000000..7890f681 --- /dev/null +++ b/.github/workflows/push-dashboard-image.yml @@ -0,0 +1,47 @@ +name: Build dashboard containers + +env: + DOCKER_REGISTRY: nethermind.jfrog.io + REPO: nubia-docker-local-prod + IMAGE_NAME: p2p-dashboard + +on: + push: + branches: + - main + paths: + - 'dashboard/**' + - '.github/workflows/push-dashboard-image.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + Build: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Define image tag + run: | + TAG=$(git describe --tags --always) + echo "DOCKER_IMAGE_TAG=$TAG" >> $GITHUB_ENV + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to registry + run: | + docker login ${{ env.DOCKER_REGISTRY }} -u ${{ secrets.ARTIFACTORY_NUBIA_USERNAME }} -p ${{ secrets.ARTIFACTORY_NUBIA_TOKEN_DEVELOPER}} + + - name: Build backend image + uses: docker/build-push-action@v6 + with: + context: ./dashboard + file: ./dashboard/backend.Dockerfile + platforms: "linux/amd64" + tags: | + ${{ env.DOCKER_REGISTRY }}/${{ env.REPO }}/${{ env.IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }} + ${{ env.DOCKER_REGISTRY }}/${{ env.REPO }}/${{ env.IMAGE_NAME }}:latest diff --git a/dashboard/Dockerfile b/dashboard/Dockerfile new file mode 100644 index 00000000..5b09aae7 --- /dev/null +++ b/dashboard/Dockerfile @@ -0,0 +1,9 @@ +FROM node:23-slim + +WORKDIR /app + +COPY . . + +RUN npm install && npm run build + +ENTRYPOINT ["npm", "run", "server"]