Skip to content
This repository was archived by the owner on May 9, 2025. It is now read-only.

Commit 64edca2

Browse files
committed
feat: build and push docker image to ghcr
1 parent 049159e commit 64edca2

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/workflows/ghcr.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build and publish a Docker image to ghcr.io
2+
on:
3+
push:
4+
tags: [ "v*.*.*" ]
5+
branches: [ "build-automation" ]
6+
workflow_dispatch:
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: "ubuntu-latest"
15+
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Log in to the Container registry
23+
uses: docker/login-action@v2
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
- name: Extract metadata (tags, labels) for Docker
29+
id: meta
30+
uses: docker/metadata-action@v4
31+
with:
32+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
33+
- name: Build and push Docker image
34+
uses: docker/build-push-action@v3
35+
with:
36+
context: .
37+
push: true
38+
tags: ${{ steps.meta.outputs.tags }}
39+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN go mod download
1515
COPY main.go main.go
1616
COPY api/ api/
1717
COPY controllers/ controllers/
18+
COPY pkg/ pkg/
1819

1920
# Build
2021
# the GOARCH has not a default value to allow the binary be built according to the host where the command

0 commit comments

Comments
 (0)