Skip to content

Commit 41d7404

Browse files
authored
chore: update all go builds to 1.25.1 (#164)
* chore: update all go builds to 1.25.1 This brings the Dockerfile and `go.mod` up-to-date with the `stable` designation we use in our GHA workflows. This change also includes some Docker hygiene updates with the includion of `.dockerignore` and a `README.md` with clear instructions on building and running the image. Finally, a basic CI workflow is added for the Dockerfile to ensure it receives better maintenance/attention moving forward. Signed-off-by: Travis Truman <trumant@gmail.com> * feat: adopt app-specific user in container image Signed-off-by: Travis Truman <trumant@gmail.com> * fix(ci): secure checkout action usage Signed-off-by: Travis Truman <trumant@gmail.com> * chore(ci): update golangci-lint version * chore(ci): pin docker actions to ref Signed-off-by: Travis Truman <trumant@gmail.com> --------- Signed-off-by: Travis Truman <trumant@gmail.com>
1 parent 6eeb576 commit 41d7404

File tree

6 files changed

+61
-9
lines changed

6 files changed

+61
-9
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11
config.yml
2+
evaluation_results
3+
.github
4+
.goreleaser.yml
5+
.gitignore
6+
example-config.yml
7+
github-repo
8+
*.png
9+
*.md

.github/workflows/docker-ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Docker CI
2+
3+
on:
4+
push:
5+
paths:
6+
- 'Dockerfile'
7+
- '.dockerignore'
8+
pull_request:
9+
paths:
10+
- 'Dockerfile'
11+
- '.dockerignore'
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v5
21+
with:
22+
persist-credentials: false
23+
- name: Set up buildx
24+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
25+
- name: Build container image
26+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
27+
with:
28+
context: .
29+
file: ./Dockerfile
30+
push: false

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
- name: golangci-lint
2525
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9
2626
with:
27-
version: v2.1
27+
version: v2.5.0

Dockerfile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
FROM alpine:3.21 AS core
1+
FROM alpine:3.22 AS core
22
RUN apk add --no-cache wget tar unzip
33

44
WORKDIR /app
5-
ARG VERSION=0.7.0
5+
ARG VERSION=0.9.1
66
ARG PLATFORM=Linux_x86_64 # Change this based on your target system
77

88
RUN wget https://github.com/privateerproj/privateer/releases/download/v${VERSION}/privateer_${PLATFORM}.tar.gz
99
RUN tar -xzf privateer_${PLATFORM}.tar.gz
1010

11-
FROM golang:1.23.4-alpine3.21 AS plugin
11+
FROM golang:1.25.1-alpine3.22 AS plugin
1212
RUN apk add --no-cache make git
1313
WORKDIR /plugin
1414
COPY . .
1515
RUN make binary
1616

17-
FROM golang:1.23.4-alpine3.21
18-
RUN apk add --no-cache make git && \
19-
mkdir -p /.privateer/bin
17+
FROM golang:1.25.1-alpine3.22
18+
RUN addgroup -g 1001 -S appgroup && adduser -u 1001 -S appuser -G appgroup
19+
20+
RUN mkdir -p /.privateer/bin && chown -R appuser:appgroup /.privateer
2021
WORKDIR /.privateer/bin
22+
USER appuser
23+
2124
COPY --from=core /app/privateer .
2225
COPY --from=plugin /plugin/github-repo .
2326
COPY --from=plugin /plugin/container-entrypoint.sh .
2427

2528
# The config file must be provided at run time.
26-
# example: docker run -v /path/to/config.yml:/.privateer/bin/config.yml privateer-image
29+
# example: docker run -v /path/to/config.yml:/.privateer/config.yml privateer-image
2730
CMD ["./container-entrypoint.sh"]

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ Currently 39 control requirements across OSPS Baselines levels 1-3 are covered,
1212

1313
Level 2 and Level 3 requirements are undergoing current development and may be less rigorously tested.
1414

15+
## Docker Usage
16+
17+
```sh
18+
# build the image
19+
docker build . -t local
20+
docker run \
21+
--mount type=bind,source=./config.yml,destination=/.privateer/config.yml \
22+
--mount type=bind,source=./evaluation_results,destination=/.privateer/bin/evaluation_results \
23+
local
24+
```
25+
1526
## GitHub Actions Usage
1627

1728
We've pushed an image to docker hub for use in GitHub Actions.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/revanite-io/pvtr-github-repo // Replace this globally with your module name
22

3-
go 1.24.4
3+
go 1.25.1
44

55
require (
66
github.com/goccy/go-yaml v1.18.0

0 commit comments

Comments
 (0)