Skip to content

Commit f4e1f09

Browse files
committed
chore: Add Docker build pipeline workflow
1 parent aeb4723 commit f4e1f09

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/build-image.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# It automatically builds your Docker image and pushes it to GHCR
2+
name: Build and Push Docker Image
3+
4+
# We will run this workflow every time you push to the 'main' branch
5+
on:
6+
push:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build-and-push:
11+
runs-on: ubuntu-latest # Use a standard GitHub-hosted runner
12+
permissions:
13+
contents: read
14+
packages: write # Give the job permission to write to GHCR
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Log in to GitHub Container Registry
21+
uses: docker/login-action@v3
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Build and push Docker image
28+
uses: docker/build-push-action@v5
29+
with:
30+
context: .
31+
file: ./Dockerfile
32+
push: true # Push the image after building
33+
tags: |
34+
ghcr.io/${{ github.repository }}:latest
35+
ghcr.io/${{ github.repository }}:${{ github.sha }}

0 commit comments

Comments
 (0)