From fa684bca8eb855bb5bad3a4008cd96c402b92689 Mon Sep 17 00:00:00 2001 From: "Becker, Christoph" Date: Thu, 17 Oct 2024 11:49:40 +0200 Subject: [PATCH 1/4] feat: add docker build for the latest version chore: change target branch --- .github/workflows/build-docker.yaml | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/build-docker.yaml diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml new file mode 100644 index 0000000..36a3517 --- /dev/null +++ b/.github/workflows/build-docker.yaml @@ -0,0 +1,44 @@ +name: Create and publish a Docker image + +on: + push: + branches: ['main'] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: accenture/federated-catalogue-viewer + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + context: . + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest From 60970f5df5ab6eb6d43dad416c192a47f8e73745 Mon Sep 17 00:00:00 2001 From: "Becker, Christoph" Date: Thu, 17 Oct 2024 12:02:23 +0200 Subject: [PATCH 2/4] chore: improve build performance for multi arch docker builds --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 73762b0..776f662 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:18 as build-deps +FROM --platform=$BUILDPLATFORM node:18 AS build-deps WORKDIR /usr/src/app COPY package.json package-lock.json ./ From 26b2853fadd686ffe11c5d7dbe1cc082ebfa1ecf Mon Sep 17 00:00:00 2001 From: "Becker, Christoph" Date: Thu, 17 Oct 2024 15:23:21 +0200 Subject: [PATCH 3/4] feat: add prebuild image to docker compose --- README.md | 3 ++- docker-compose.yaml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d656b99..620c463 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ User interface to interact with the [XFSC Federated Catalogue](https://gitlab.ec ## Running the app 1. Run `cp example.env .env` and adjust the variables to connect to your catalog instance. -2. Run `docker compose up` to start the app. The UI will be available at `http://localhost:4200/`. +2. Run `docker compose up` to start the app using a prebuild Docker image. `docker compose up --build` will build and run the application. +3. The UI will be available at `http://localhost:4200/`. Make sure to add a read-only user to your catalog configuration first. If `DEMO_USERNAME` and `DEMO_USERNAME` are set in your environment, the catalog frontend will automatically authenticate itself. Be aware that this is a frontend component only -- if set, the credentials will be accessible in the browser. diff --git a/docker-compose.yaml b/docker-compose.yaml index 4daaaa9..af448d8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,6 +2,7 @@ services: frontend: build: context: . + image: ghcr.io/accenture/federated-catalogue-viewer:latest ports: - '4200:8080' env_file: .env From 243efb0d16c3c6d9f4ea8f3e622462699bb43f7e Mon Sep 17 00:00:00 2001 From: "Becker, Christoph" Date: Thu, 17 Oct 2024 15:25:29 +0200 Subject: [PATCH 4/4] chore: remove unsed permissions for build job --- .github/workflows/build-docker.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml index 36a3517..989dcce 100644 --- a/.github/workflows/build-docker.yaml +++ b/.github/workflows/build-docker.yaml @@ -15,8 +15,6 @@ jobs: permissions: contents: read packages: write - attestations: write - id-token: write steps: - name: Checkout repository