Skip to content

Commit 07df775

Browse files
authored
Push container images to OCI (#336)
Signed-off-by: Sergio Castaño Arteaga <[email protected]>
1 parent f23c389 commit 07df775

File tree

1 file changed

+64
-3
lines changed

1 file changed

+64
-3
lines changed

.github/workflows/build-images.yml

Lines changed: 64 additions & 3 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-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/[email protected]
34+
with:
35+
auth_token: ${{ secrets.OCI_AUTH_TOKEN }}
36+
- name: Get gitjobs-dbmigrator OCIR repository
37+
id: get-ocir-repository-dbmigrator
38+
uses: oracle-actions/[email protected]
39+
with:
40+
name: gitjobs/dbmigrator
41+
compartment: ${{ secrets.OCI_COMPARTMENT_OCID }}
2442
- name: Build and push gitjobs-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/gitjobs/dbmigrator:$GITHUB_SHA .
48+
docker build \
49+
-f database/migrations/Dockerfile \
50+
-t $ECR_REGISTRY/gitjobs/dbmigrator:$GITHUB_SHA \
51+
-t $OCIR_REPOSITORY:$GITHUB_SHA \
52+
.
2953
docker push $ECR_REGISTRY/gitjobs/dbmigrator:$GITHUB_SHA
54+
docker push $OCIR_REPOSITORY:$GITHUB_SHA
3055
3156
build-server-image:
3257
if: github.ref == 'refs/heads/main'
@@ -43,12 +68,30 @@ 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/[email protected]
74+
with:
75+
auth_token: ${{ secrets.OCI_AUTH_TOKEN }}
76+
- name: Get gitjobs-server OCIR repository
77+
id: get-ocir-repository-server
78+
uses: oracle-actions/[email protected]
79+
with:
80+
name: gitjobs/server
81+
compartment: ${{ secrets.OCI_COMPARTMENT_OCID }}
4682
- name: Build and push gitjobs-server 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 -f gitjobs-server/Dockerfile -t $ECR_REGISTRY/gitjobs/server:$GITHUB_SHA .
88+
docker build \
89+
-f gitjobs-server/Dockerfile \
90+
-t $ECR_REGISTRY/gitjobs/server:$GITHUB_SHA \
91+
-t $OCIR_REPOSITORY:$GITHUB_SHA \
92+
.
5193
docker push $ECR_REGISTRY/gitjobs/server:$GITHUB_SHA
94+
docker push $OCIR_REPOSITORY:$GITHUB_SHA
5295
5396
build-syncer-image:
5497
if: github.ref == 'refs/heads/main'
@@ -65,9 +108,27 @@ jobs:
65108
- name: Login to AWS ECR
66109
id: login-ecr
67110
uses: aws-actions/amazon-ecr-login@v2
111+
- name: Login to OCI Registry
112+
id: login-ocir
113+
uses: oracle-actions/[email protected]
114+
with:
115+
auth_token: ${{ secrets.OCI_AUTH_TOKEN }}
116+
- name: Get gitjobs-syncer OCIR repository
117+
id: get-ocir-repository-syncer
118+
uses: oracle-actions/[email protected]
119+
with:
120+
name: gitjobs/syncer
121+
compartment: ${{ secrets.OCI_COMPARTMENT_OCID }}
68122
- name: Build and push gitjobs-syncer image
69123
env:
70124
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
125+
OCIR_REGISTRY: ${{ steps.login-ocir.outputs.ocir_endpoint }}
126+
OCIR_REPOSITORY: ${{ steps.get-ocir-repository-syncer.outputs.repo_path }}
71127
run: |
72-
docker build -f gitjobs-syncer/Dockerfile -t $ECR_REGISTRY/gitjobs/syncer:$GITHUB_SHA .
128+
docker build \
129+
-f gitjobs-syncer/Dockerfile \
130+
-t $ECR_REGISTRY/gitjobs/syncer:$GITHUB_SHA \
131+
-t $OCIR_REPOSITORY:$GITHUB_SHA \
132+
.
73133
docker push $ECR_REGISTRY/gitjobs/syncer:$GITHUB_SHA
134+
docker push $OCIR_REPOSITORY:$GITHUB_SHA

0 commit comments

Comments
 (0)