Skip to content

Commit 2da88b2

Browse files
mjuravadorovsky
authored andcommitted
Build container image for lockc on ghcr.io
Signed-off-by: Michal Jura <[email protected]>
1 parent ff1d149 commit 2da88b2

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
tags:
6+
- 'v*'
7+
8+
name: build container image
9+
10+
jobs:
11+
build:
12+
name: Build container image
13+
runs-on: ubuntu-latest
14+
steps:
15+
-
16+
name: Checkout code
17+
uses: actions/checkout@v2
18+
-
19+
name: Set up QEMU
20+
uses: docker/setup-qemu-action@v1
21+
-
22+
name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v1
24+
-
25+
name: Login to GitHub Container Registry
26+
uses: docker/login-action@v1
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.repository_owner }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
-
32+
name: Build and push development container image
33+
if: ${{ startsWith(github.ref, 'refs/heads/') }}
34+
uses: docker/build-push-action@v2
35+
with:
36+
context: .
37+
file: ./Dockerfile
38+
platforms: linux/amd64, linux/arm64
39+
push: true
40+
tags: |
41+
ghcr.io/rancher-sandbox/lockc:latest
42+
-
43+
name: Retrieve tag name
44+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
45+
run: |
46+
echo TAG_NAME=$(echo $GITHUB_REF | sed -e "s|refs/tags/||") >> $GITHUB_ENV
47+
-
48+
name: Build and push tagged container image
49+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
50+
uses: docker/build-push-action@v2
51+
with:
52+
context: .
53+
file: ./Dockerfile
54+
platforms: linux/amd64
55+
push: true
56+
tags: |
57+
ghcr.io/rancher-sandbox/lockc:${{ env.TAG_NAME }}

0 commit comments

Comments
 (0)