Skip to content

Commit a58cb56

Browse files
committed
Create publish-container-image-icr-validate.yml
1 parent 865d002 commit a58cb56

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Publish container image
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
publish_to_registry:
10+
name: Build and push image to registry
11+
runs-on: ubuntu-latest
12+
env:
13+
ICR_NAMESPACE: solution-tutorials
14+
ICR_REPOSITORY_FRONTEND: tutorial-text-analysis-code-engine-frontend
15+
ICR_REPOSITORY_BACKEND: tutorial-text-analysis-code-engine-backend
16+
ICR_REPOSITORY_BACKEND_JOB: tutorial-text-analysis-code-engine-backend-job
17+
steps:
18+
- name: Check out the repo
19+
uses: actions/checkout@v4
20+
21+
- name: Log in to Container Registry
22+
uses: docker/login-action@v3
23+
with:
24+
registry: icr.io
25+
username: ${{ secrets.ICR_USER }}
26+
password: ${{ secrets.ICR_TOKEN }}
27+
28+
- name: Extract metadata (tags, labels) for Docker
29+
id: meta-frontend
30+
uses: docker/metadata-action@v5
31+
with:
32+
images: icr.io/${{ env.ICR_NAMESPACE }}/${{ env.ICR_REPOSITORY_FRONTEND }}
33+
34+
- name: Build and push image
35+
uses: docker/build-push-action@v5
36+
with:
37+
context: ./frontend
38+
file: ./frontend/Dockerfile
39+
push: true
40+
tags: ${{ steps.meta-frontend.outputs.tags }}
41+
labels: ${{ steps.meta-frontend.outputs.labels }}
42+
43+
- name: Extract metadata (tags, labels) for Docker
44+
id: meta-backend
45+
uses: docker/metadata-action@v5
46+
with:
47+
images: icr.io/${{ env.ICR_NAMESPACE }}/${{ env.ICR_REPOSITORY_BACKEND }}
48+
49+
- name: Build and push image
50+
uses: docker/build-push-action@v5
51+
with:
52+
context: ./backend
53+
file: ./backend/Dockerfile
54+
push: true
55+
tags: ${{ steps.meta-backend.outputs.tags }}
56+
labels: ${{ steps.meta-backend.outputs.labels }}
57+
58+
- name: Extract metadata (tags, labels) for Docker
59+
id: meta-backend-job
60+
uses: docker/metadata-action@v5
61+
with:
62+
images: icr.io/${{ env.ICR_NAMESPACE }}/${{ env.ICR_REPOSITORY_BACKEND_JOB }}
63+
64+
- name: Build and push image
65+
uses: docker/build-push-action@v5
66+
with:
67+
context: ./jobs
68+
file: ./jobs/Dockerfile
69+
push: true
70+
tags: ${{ steps.meta-backend-job.outputs.tags }}
71+
labels: ${{ steps.meta-backend-job.outputs.labels }}

0 commit comments

Comments
 (0)