Skip to content

Commit 1744d30

Browse files
committed
ci/cd: build image on push
1 parent 0b2ec7e commit 1744d30

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
- name: Set up QEMU
18+
uses: docker/setup-qemu-action@v3
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Login to GitHub Container Registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{github.repository_owner}}
27+
password: ${{secrets.GITHUB_TOKEN}}
28+
- name: Docker metadata
29+
id: meta
30+
uses: docker/metadata-action@v5
31+
with:
32+
images: |
33+
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
34+
tags: |
35+
type=raw,value=latest,enable={{is_default_branch}}
36+
37+
- name: Build and push container image
38+
uses: docker/build-push-action@v6
39+
id: container-build-push
40+
with:
41+
context: .
42+
platforms: linux/amd64,linux/arm64
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}
46+
file: Dockerfile

0 commit comments

Comments
 (0)