Skip to content

Commit 887c84c

Browse files
committed
publish image on github
1 parent de44e90 commit 887c84c

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# .github/workflows/docker-publish.yml
2+
name: Build and Push Docker Image
3+
4+
on:
5+
push:
6+
branches: [ main ]
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build-and-push:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- name: Checkout repository with submodules
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
submodules: 'true'
26+
27+
- name: Free Disk Space
28+
uses: jlumbroso/free-disk-space@main
29+
with:
30+
tool-cache: false
31+
android: true
32+
dotnet: true
33+
haskell: true
34+
large-packages: true
35+
docker-images: true
36+
swap-storage: true
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Log in to GitHub Container Registry
42+
uses: docker/login-action@v3
43+
with:
44+
registry: ${{ env.REGISTRY }}
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Extract metadata
49+
id: meta
50+
uses: docker/metadata-action@v5
51+
with:
52+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
53+
tags: |
54+
type=ref,event=branch
55+
type=ref,event=pr
56+
type=sha
57+
type=raw,value=latest,enable={{is_default_branch}}
58+
59+
- name: Build and push Docker image
60+
uses: docker/build-push-action@v6
61+
with:
62+
context: .
63+
push: true
64+
provenance: false
65+
platforms: linux/amd64,linux/arm64
66+
tags: ${{ steps.meta.outputs.tags }}
67+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)