Skip to content

Commit b67b525

Browse files
authored
Push container images to OCI (#671)
Signed-off-by: Sergio Castaño Arteaga <tegioz@icloud.com>
1 parent 9b1208f commit b67b525

1 file changed

Lines changed: 44 additions & 2 deletions

File tree

.github/workflows/build-images.yml

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ on:
55
branches:
66
- main
77

8+
env:
9+
OCI_CLI_FINGERPRINT: ${{ secrets.OCI_CLI_FINGERPRINT }}
10+
OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_CLI_KEY_CONTENT }}
11+
OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }}
12+
OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }}
13+
OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }}
14+
815
jobs:
916
build-gitvote-dbmigrator-image:
1017
if: github.ref == 'refs/heads/main'
@@ -21,12 +28,30 @@ jobs:
2128
- name: Login to AWS ECR
2229
id: login-ecr
2330
uses: aws-actions/amazon-ecr-login@v2
31+
- name: Login to OCI Registry
32+
id: login-ocir
33+
uses: oracle-actions/login-ocir@v1.3.0
34+
with:
35+
auth_token: ${{ secrets.OCI_AUTH_TOKEN }}
36+
- name: Get gitvote dbmigrator OCIR repository
37+
id: get-ocir-repository-dbmigrator
38+
uses: oracle-actions/get-ocir-repository@v1.3.0
39+
with:
40+
name: gitvote/dbmigrator
41+
compartment: ${{ secrets.OCI_COMPARTMENT_OCID }}
2442
- name: Build and push gitvote-dbmigrator image
2543
env:
2644
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
45+
OCIR_REGISTRY: ${{ steps.login-ocir.outputs.ocir_endpoint }}
46+
OCIR_REPOSITORY: ${{ steps.get-ocir-repository-dbmigrator.outputs.repo_path }}
2747
run: |
28-
docker build -f database/migrations/Dockerfile -t $ECR_REGISTRY/gitvote-dbmigrator:$GITHUB_SHA .
48+
docker build \
49+
-f database/migrations/Dockerfile \
50+
-t $ECR_REGISTRY/gitvote-dbmigrator:$GITHUB_SHA \
51+
-t $OCIR_REPOSITORY:$GITHUB_SHA \
52+
.
2953
docker push $ECR_REGISTRY/gitvote-dbmigrator:$GITHUB_SHA
54+
docker push $OCIR_REPOSITORY:$GITHUB_SHA
3055
3156
build-gitvote-image:
3257
if: github.ref == 'refs/heads/main'
@@ -43,9 +68,26 @@ jobs:
4368
- name: Login to AWS ECR
4469
id: login-ecr
4570
uses: aws-actions/amazon-ecr-login@v2
71+
- name: Login to OCI Registry
72+
id: login-ocir
73+
uses: oracle-actions/login-ocir@v1.3.0
74+
with:
75+
auth_token: ${{ secrets.OCI_AUTH_TOKEN }}
76+
- name: Get gitvote server OCIR repository
77+
id: get-ocir-repository-server
78+
uses: oracle-actions/get-ocir-repository@v1.3.0
79+
with:
80+
name: gitvote/server
81+
compartment: ${{ secrets.OCI_COMPARTMENT_OCID }}
4682
- name: Build and push gitvote image
4783
env:
4884
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
85+
OCIR_REGISTRY: ${{ steps.login-ocir.outputs.ocir_endpoint }}
86+
OCIR_REPOSITORY: ${{ steps.get-ocir-repository-server.outputs.repo_path }}
4987
run: |
50-
docker build -t $ECR_REGISTRY/gitvote:$GITHUB_SHA .
88+
docker build \
89+
-t $ECR_REGISTRY/gitvote:$GITHUB_SHA \
90+
-t $OCIR_REPOSITORY:$GITHUB_SHA \
91+
.
5192
docker push $ECR_REGISTRY/gitvote:$GITHUB_SHA
93+
docker push $OCIR_REPOSITORY:$GITHUB_SHA

0 commit comments

Comments
 (0)