From 0789870f4606f99f392057b9f9aa132db7c613f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Casta=C3=B1o=20Arteaga?= Date: Wed, 29 Oct 2025 17:08:56 +0100 Subject: [PATCH] Push container images to OCI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sergio CastaƱo Arteaga --- .github/workflows/build-images.yml | 46 ++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index fd3e96e..11a14d2 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -5,6 +5,13 @@ on: branches: - main +env: + OCI_CLI_FINGERPRINT: ${{ secrets.OCI_CLI_FINGERPRINT }} + OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_CLI_KEY_CONTENT }} + OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }} + OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }} + OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }} + jobs: build-gitvote-dbmigrator-image: if: github.ref == 'refs/heads/main' @@ -21,12 +28,30 @@ jobs: - name: Login to AWS ECR id: login-ecr uses: aws-actions/amazon-ecr-login@v2 + - name: Login to OCI Registry + id: login-ocir + uses: oracle-actions/login-ocir@v1.3.0 + with: + auth_token: ${{ secrets.OCI_AUTH_TOKEN }} + - name: Get gitvote dbmigrator OCIR repository + id: get-ocir-repository-dbmigrator + uses: oracle-actions/get-ocir-repository@v1.3.0 + with: + name: gitvote/dbmigrator + compartment: ${{ secrets.OCI_COMPARTMENT_OCID }} - name: Build and push gitvote-dbmigrator image env: ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + OCIR_REGISTRY: ${{ steps.login-ocir.outputs.ocir_endpoint }} + OCIR_REPOSITORY: ${{ steps.get-ocir-repository-dbmigrator.outputs.repo_path }} run: | - docker build -f database/migrations/Dockerfile -t $ECR_REGISTRY/gitvote-dbmigrator:$GITHUB_SHA . + docker build \ + -f database/migrations/Dockerfile \ + -t $ECR_REGISTRY/gitvote-dbmigrator:$GITHUB_SHA \ + -t $OCIR_REPOSITORY:$GITHUB_SHA \ + . docker push $ECR_REGISTRY/gitvote-dbmigrator:$GITHUB_SHA + docker push $OCIR_REPOSITORY:$GITHUB_SHA build-gitvote-image: if: github.ref == 'refs/heads/main' @@ -43,9 +68,26 @@ jobs: - name: Login to AWS ECR id: login-ecr uses: aws-actions/amazon-ecr-login@v2 + - name: Login to OCI Registry + id: login-ocir + uses: oracle-actions/login-ocir@v1.3.0 + with: + auth_token: ${{ secrets.OCI_AUTH_TOKEN }} + - name: Get gitvote server OCIR repository + id: get-ocir-repository-server + uses: oracle-actions/get-ocir-repository@v1.3.0 + with: + name: gitvote/server + compartment: ${{ secrets.OCI_COMPARTMENT_OCID }} - name: Build and push gitvote image env: ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + OCIR_REGISTRY: ${{ steps.login-ocir.outputs.ocir_endpoint }} + OCIR_REPOSITORY: ${{ steps.get-ocir-repository-server.outputs.repo_path }} run: | - docker build -t $ECR_REGISTRY/gitvote:$GITHUB_SHA . + docker build \ + -t $ECR_REGISTRY/gitvote:$GITHUB_SHA \ + -t $OCIR_REPOSITORY:$GITHUB_SHA \ + . docker push $ECR_REGISTRY/gitvote:$GITHUB_SHA + docker push $OCIR_REPOSITORY:$GITHUB_SHA