Skip to content

Commit 7e7765d

Browse files
committed
GH action
1 parent 9897053 commit 7e7765d

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish container image
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish_to_registry:
9+
name: Build and push image to registry
10+
runs-on: ubuntu-latest
11+
env:
12+
ICR_NAMESPACE: solution-tutorials
13+
ICR_REPOSITORY: tutorial-cloud-sql-database
14+
steps:
15+
- name: Check out the repo
16+
uses: actions/checkout@v2
17+
18+
- name: Log in to Container Registry
19+
uses: docker/login-action@v1.10.0
20+
with:
21+
registry: icr.io
22+
username: ${{ secrets.ICR_USER }}
23+
password: ${{ secrets.ICR_TOKEN }}
24+
25+
- name: Extract metadata (tags, labels) for Docker
26+
id: meta
27+
uses: docker/metadata-action@v3.6.2
28+
with:
29+
images: icr.io/${{ env.ICR_NAMESPACE }}/${{ env.ICR_REPOSITORY }}
30+
31+
- name: Build and push image
32+
uses: docker/build-push-action@v2.8.0
33+
with:
34+
context: ./app
35+
file: ./app/Dockerfile
36+
push: true
37+
tags: ${{ steps.meta.outputs.tags }}
38+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)