Skip to content

Commit 9915556

Browse files
authored
Merge pull request #13 from Intellection/github_actions_test_and_release
[SRE-4238] Use Github Actions to test and release multi-platform docker image
2 parents 9eadb9b + c55e8a7 commit 9915556

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.github/workflows/release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: release-docker-image
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
github-release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
- name: Create Release
15+
uses: actions/create-release@v1
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
with:
19+
tag_name: ${{ github.ref }}
20+
release_name: Version ${{ github.ref }}
21+
draft: false
22+
prerelease: false
23+
docker-hub-release:
24+
needs: github-release
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
- name: Prepare image metadata
30+
id: metadata
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: zappi/nginx
34+
- name: Set up QEMU
35+
uses: docker/setup-qemu-action@v3
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v3
38+
- name: Login to Docker Hub
39+
uses: docker/login-action@v3
40+
with:
41+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
42+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
43+
- name: Build, tag, and push image to Amazon ECR
44+
uses: docker/build-push-action@v6
45+
with:
46+
cache-from: type=gha
47+
cache-to: type=gha,mode=max
48+
context: .
49+
labels: ${{ steps.metadata.outputs.labels }}
50+
platforms: linux/amd64,linux/arm64
51+
push: true
52+
tags: ${{ steps.metadata.outputs.tags }}
53+
- name: Update description on Docker Hub Description
54+
uses: peter-evans/dockerhub-description@v4
55+
with:
56+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
57+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
58+
repository: zappi/nginx

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: test-docker-image
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'master'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
- name: Prepare image metadata
15+
id: metadata
16+
uses: docker/metadata-action@v5
17+
with:
18+
images: zappi/nginx
19+
- name: Set up QEMU
20+
uses: docker/setup-qemu-action@v3
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
- name: Test multi-arch building of image
24+
uses: docker/build-push-action@v6
25+
with:
26+
cache-from: type=gha
27+
cache-to: type=gha,mode=max
28+
context: .
29+
labels: ${{ steps.metadata.outputs.labels }}
30+
platforms: linux/amd64,linux/arm64
31+
push: false
32+
tags: ${{ steps.metadata.outputs.tags }}

0 commit comments

Comments
 (0)