From 9dbd328ce46fc85fbbd78597bc7c81807c74c6c2 Mon Sep 17 00:00:00 2001 From: KambleSahil3 Date: Tue, 25 Mar 2025 11:48:56 +0530 Subject: [PATCH 1/6] feat: added yml file to push docker images to github Signed-off-by: KambleSahil3 --- .github/workflows/credo-controller.yml | 110 +++++++++++++++++++++++++ Dockerfile | 47 +---------- 2 files changed, 111 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/credo-controller.yml diff --git a/.github/workflows/credo-controller.yml b/.github/workflows/credo-controller.yml new file mode 100644 index 00000000..0c944b1f --- /dev/null +++ b/.github/workflows/credo-controller.yml @@ -0,0 +1,110 @@ +name: Credo-Controller + +on: + push: + tags: + - 'v*' + +env: + SERVICE: credo-controller + +jobs: + build-and-push: + name: Push Docker image to GitHub + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write +name: Credo-Controller + +on: + push: + tags: + - 'v*' + +env: + SERVICE: credo-controller + +jobs: + build-and-push: + name: Push Docker image to GitHub + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Extract Git Tag + id: get_tag + run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.TOKEN_GITHUB }} + + - name: Build and Push Docker Image + run: | + REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') + SERVICE_NAME="${{ env.SERVICE }}" + IMAGE_TAG="${{ env.TAG }}" + + IMAGE_NAME="ghcr.io/${REPO_OWNER}/${SERVICE_NAME}:${IMAGE_TAG}" + IMAGE_LATEST="ghcr.io/${REPO_OWNER}/${SERVICE_NAME}:latest" + + echo "Building Docker image for credo-controller ..." + docker build -t $IMAGE_NAME . + + docker tag "${IMAGE_NAME}" "${IMAGE_LATEST}" + + echo "📤 Pushing Docker image: ${IMAGE_NAME}" + docker push "${IMAGE_NAME}" + + echo "📤 Pushing Docker image: ${IMAGE_LATEST}" + docker push "${IMAGE_LATEST}" + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Extract Git Tag + id: get_tag + run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.TOKEN_GITHUB }} + + - name: Build and Push Docker Image + run: | + REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') + SERVICE_NAME="${{ env.SERVICE }}" + IMAGE_TAG="${{ env.TAG }}" + + IMAGE_NAME="ghcr.io/${REPO_OWNER}/${SERVICE_NAME}:${IMAGE_TAG}" + IMAGE_LATEST="ghcr.io/${REPO_OWNER}/${SERVICE_NAME}:latest" + + echo "Building Docker image for credo-controller ..." + docker build -t $IMAGE_NAME . + + docker tag "${IMAGE_NAME}" "${IMAGE_LATEST}" + + echo "📤 Pushing Docker image: ${IMAGE_NAME}" + docker push "${IMAGE_NAME}" + + echo "📤 Pushing Docker image: ${IMAGE_LATEST}" + docker push "${IMAGE_LATEST}" + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 210d04ee..c8175271 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,48 +1,3 @@ -# FROM ubuntu:20.04 - -# ENV DEBIAN_FRONTEND noninteractive - -# RUN apt-get update -y && apt-get install -y \ -# software-properties-common \ -# apt-transport-https \ -# curl \ -# # Only needed to build indy-sdk -# build-essential - -# RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - - -# # yarn -# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ -# echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list - -# # install depdencies -# RUN apt-get update -y && apt-get install -y --allow-unauthenticated \ -# nodejs - -# # install depdencies -# RUN apt-get update -y && apt-get install -y --allow-unauthenticated \ -# nodejs - -# # Install yarn seperately due to `no-install-recommends` to skip nodejs install -# RUN apt-get install -y --no-install-recommends yarn - -# RUN yarn global add patch-package -# # AFJ specifc setup -# WORKDIR /www - -# COPY bin ./bin -# COPY package.json ./package.json -# COPY patches ./patches - -# RUN yarn install --production - -# COPY build ./build -# # COPY libindy_vdr.so /usr/lib/ -# # COPY libindy_vdr.so /usr/local/lib/ - -# ENTRYPOINT [ "./bin/afj-rest.js", "start" ] - - # Stage 1: Builder stage FROM node:18.19.0 AS builder @@ -76,4 +31,4 @@ COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/patches ./patches # Set entry point -ENTRYPOINT ["node", "./bin/afj-rest.js", "start"] \ No newline at end of file +ENTRYPOINT ["node", "./bin/afj-rest.js", "start"] From edb2accca7b1d8231b8e03e0af571eea8600468a Mon Sep 17 00:00:00 2001 From: KambleSahil3 Date: Tue, 25 Mar 2025 11:51:02 +0530 Subject: [PATCH 2/6] feat: added yml file to push docker images to github Signed-off-by: KambleSahil3 --- .github/workflows/credo-controller.yml | 54 -------------------------- 1 file changed, 54 deletions(-) diff --git a/.github/workflows/credo-controller.yml b/.github/workflows/credo-controller.yml index 0c944b1f..30d60a7c 100644 --- a/.github/workflows/credo-controller.yml +++ b/.github/workflows/credo-controller.yml @@ -18,61 +18,7 @@ jobs: packages: write attestations: write id-token: write -name: Credo-Controller - -on: - push: - tags: - - 'v*' - -env: - SERVICE: credo-controller - -jobs: - build-and-push: - name: Push Docker image to GitHub - runs-on: ubuntu-latest - - permissions: - contents: read - packages: write - attestations: write - id-token: write - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Extract Git Tag - id: get_tag - run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.TOKEN_GITHUB }} - - - name: Build and Push Docker Image - run: | - REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') - SERVICE_NAME="${{ env.SERVICE }}" - IMAGE_TAG="${{ env.TAG }}" - IMAGE_NAME="ghcr.io/${REPO_OWNER}/${SERVICE_NAME}:${IMAGE_TAG}" - IMAGE_LATEST="ghcr.io/${REPO_OWNER}/${SERVICE_NAME}:latest" - - echo "Building Docker image for credo-controller ..." - docker build -t $IMAGE_NAME . - - docker tag "${IMAGE_NAME}" "${IMAGE_LATEST}" - - echo "📤 Pushing Docker image: ${IMAGE_NAME}" - docker push "${IMAGE_NAME}" - - echo "📤 Pushing Docker image: ${IMAGE_LATEST}" - docker push "${IMAGE_LATEST}" steps: - name: Checkout Repository uses: actions/checkout@v4 From fd0737c1360fda958b0735791a38eeb6ca8d8dd0 Mon Sep 17 00:00:00 2001 From: KambleSahil3 Date: Thu, 27 Mar 2025 12:50:22 +0530 Subject: [PATCH 3/6] fix: updated cicd.yml file Signed-off-by: KambleSahil3 --- .github/workflows/cicd.yml | 47 +++++++++++++++++++++ .github/workflows/credo-controller.yml | 56 -------------------------- 2 files changed, 47 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/cicd.yml delete mode 100644 .github/workflows/credo-controller.yml diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 00000000..20405081 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,47 @@ +name: Credo-Controller + +on: + push: + tags: + - 'v*' + +env: + REGISTRY: ghcr.io + SERVICE: credo-controller + +jobs: + build-and-push: + name: Push Docker image to GitHub + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Extract Git Tag + id: get_tag + run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push Docker Image ${{ env.SERVICE }} + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + push: true + tags: | + ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.SERVICE }}:${{ env.TAG }} + ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.SERVICE }}:latest + \ No newline at end of file diff --git a/.github/workflows/credo-controller.yml b/.github/workflows/credo-controller.yml deleted file mode 100644 index 30d60a7c..00000000 --- a/.github/workflows/credo-controller.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Credo-Controller - -on: - push: - tags: - - 'v*' - -env: - SERVICE: credo-controller - -jobs: - build-and-push: - name: Push Docker image to GitHub - runs-on: ubuntu-latest - - permissions: - contents: read - packages: write - attestations: write - id-token: write - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Extract Git Tag - id: get_tag - run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.TOKEN_GITHUB }} - - - name: Build and Push Docker Image - run: | - REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') - SERVICE_NAME="${{ env.SERVICE }}" - IMAGE_TAG="${{ env.TAG }}" - - IMAGE_NAME="ghcr.io/${REPO_OWNER}/${SERVICE_NAME}:${IMAGE_TAG}" - IMAGE_LATEST="ghcr.io/${REPO_OWNER}/${SERVICE_NAME}:latest" - - echo "Building Docker image for credo-controller ..." - docker build -t $IMAGE_NAME . - - docker tag "${IMAGE_NAME}" "${IMAGE_LATEST}" - - echo "📤 Pushing Docker image: ${IMAGE_NAME}" - docker push "${IMAGE_NAME}" - - echo "📤 Pushing Docker image: ${IMAGE_LATEST}" - docker push "${IMAGE_LATEST}" - \ No newline at end of file From 3f9af4e408a88bc0811ef9f55fa5fefc381f3d86 Mon Sep 17 00:00:00 2001 From: KambleSahil3 Date: Thu, 27 Mar 2025 13:16:24 +0530 Subject: [PATCH 4/6] fix: renamed yml file Signed-off-by: KambleSahil3 --- .github/workflows/{cicd.yml => continuous-delivery.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{cicd.yml => continuous-delivery.yml} (100%) diff --git a/.github/workflows/cicd.yml b/.github/workflows/continuous-delivery.yml similarity index 100% rename from .github/workflows/cicd.yml rename to .github/workflows/continuous-delivery.yml From c562b8b4dffbc75f78210361868ccd1491bb6bb7 Mon Sep 17 00:00:00 2001 From: KambleSahil3 Date: Thu, 27 Mar 2025 13:43:38 +0530 Subject: [PATCH 5/6] chore: removed id-token and attestations Signed-off-by: KambleSahil3 --- .github/workflows/continuous-delivery.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 20405081..f4fdcb5f 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -1,4 +1,4 @@ -name: Credo-Controller +name: Continuous Delivery on: push: @@ -17,8 +17,6 @@ jobs: permissions: contents: read packages: write - attestations: write - id-token: write steps: - name: Checkout Repository From f8e5c43a773893db17b8f0c34f8adf18d8047243 Mon Sep 17 00:00:00 2001 From: KambleSahil3 Date: Thu, 27 Mar 2025 13:51:59 +0530 Subject: [PATCH 6/6] chore: removed id-token and attestations Signed-off-by: KambleSahil3 --- .github/workflows/continuous-delivery.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 20405081..f8e6623b 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -1,4 +1,4 @@ -name: Credo-Controller +name: Continous Delivery on: push: @@ -17,8 +17,6 @@ jobs: permissions: contents: read packages: write - attestations: write - id-token: write steps: - name: Checkout Repository