Skip to content

Commit e2913ca

Browse files
committed
fix(container): tweak container to follow better practices
1 parent bfdb090 commit e2913ca

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.github/workflows/container.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ jobs:
77
build:
88
name: Build image
99
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
1013

1114
steps:
1215
- name: Checkout Repository
@@ -20,7 +23,7 @@ jobs:
2023
uses: redhat-actions/buildah-build@v2
2124
with:
2225
image: saturn
23-
tags: latest ${{ github.sha }} ${{ github.ref_name }}
26+
tags: latest ${{ github.sha }} ${{ github.ref_name.replace('/', '-') }}
2427
containerfiles: |
2528
./Containerfile
2629

Containerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ FROM docker.io/golang:1.25-alpine3.22 AS buildStage
22

33
WORKDIR /app
44

5+
COPY go.mod ./
6+
COPY go.sum ./
7+
RUN go mod download
58
COPY types.go ./
69
COPY timer.go ./
710
COPY main.go ./
8-
COPY go.mod ./
9-
COPY go.sum ./
1011

11-
RUN go build -o saturn
12+
RUN CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o saturn
1213

13-
FROM docker.io/alpine:3.20
14+
FROM docker.io/alpine:3.22
1415

1516
WORKDIR /opt
1617
COPY --from=buildStage /app/saturn /opt/saturn

0 commit comments

Comments
 (0)