Skip to content

Commit 200d849

Browse files
committed
Add GitHub Actions workflow for building and pushing Docker images
1 parent 240d35c commit 200d849

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# NOTE - https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows
2+
name: Build & Push Docker Image
3+
4+
on:
5+
workflow_call:
6+
# inputs:
7+
# config-path:
8+
# required: true
9+
# type: string
10+
secrets:
11+
GITHUB_TOKEN:
12+
required: true
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4.2.2
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3.11.1
27+
28+
- name: Log in to GitHub Container Registry
29+
uses: docker/login-action@v3.4.0
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata (tags, labels) for Docker
36+
id: meta
37+
uses: docker/metadata-action@v5.7.0
38+
with:
39+
images: ghcr.io/${{ github.repository }}
40+
41+
- name: Build and push Docker image
42+
uses: docker/build-push-action@v6.18.0
43+
with:
44+
context: .
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)