Skip to content

Commit ead8cce

Browse files
Add a CI example
Signed-off-by: Leonardo Held <[email protected]>
1 parent 2150466 commit ead8cce

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/build.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
packages: write
14+
contents: read
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Log in to GitHub Container Registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Build and Push Debian Image
31+
uses: docker/build-push-action@v6
32+
with:
33+
context: .
34+
file: Dockerfile.debian
35+
platforms: linux/amd64,linux/arm64
36+
push: true
37+
tags: ghcr.io/${{ github.repository_owner }}/myapp-debian:latest
38+
39+
- name: Build and Push Alpine Image
40+
uses: docker/build-push-action@v6
41+
with:
42+
context: .
43+
file: Dockerfile.alpine
44+
platforms: linux/amd64,linux/arm64
45+
push: true
46+
tags: ghcr.io/${{ github.repository_owner }}/myapp-alpine:latest
47+
48+
- name: Build and Push Distroless Image
49+
uses: docker/build-push-action@v6
50+
with:
51+
context: .
52+
file: Dockerfile.distroless
53+
platforms: linux/amd64,linux/arm64
54+
push: true
55+
tags: ghcr.io/${{ github.repository_owner }}/myapp-distroless:latest
56+

0 commit comments

Comments
 (0)