Skip to content

Commit 409fc60

Browse files
committed
GH-3 CI/CD for Docker images
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 2835312 commit 409fc60

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

.github/workflows/ci-docker.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Docker CI
2+
3+
on:
4+
pull_request:
5+
branches: ['main']
6+
paths: ['Dockerfile','cmd','internal','go.*','.github/workflows/ci-docker.yml']
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: cloudstruct/cardano-submit-api
11+
12+
jobs:
13+
docker:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: qemu
18+
uses: docker/setup-qemu-action@v1
19+
- uses: docker/setup-buildx-action@v1
20+
- id: meta
21+
uses: docker/metadata-action@v3
22+
with:
23+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
24+
- name: build
25+
uses: docker/build-push-action@v2
26+
with:
27+
context: .
28+
push: false
29+
### TODO: test multiple platforms
30+
# platforms: linux/amd64,linux/arm64
31+
tags: ${{ steps.meta.outputs.tags }}
32+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
release:
7+
types: ['published']
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: cloudstruct/cardano-submit-api
12+
13+
jobs:
14+
build-and-push-image:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: qemu
22+
uses: docker/setup-qemu-action@v1
23+
- uses: docker/setup-buildx-action@v1
24+
- name: login
25+
uses: docker/login-action@v1
26+
with:
27+
registry: ${{ env.REGISTRY }}
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
- id: meta
31+
uses: docker/metadata-action@v3
32+
with:
33+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
34+
- name: push
35+
uses: docker/build-push-action@v2
36+
with:
37+
context: .
38+
push: true
39+
platforms: linux/amd64,linux/arm64
40+
tags: ${{ steps.meta.outputs.tags }}
41+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)