Skip to content

Commit ec9bacb

Browse files
committed
chore(shared/statsd-exporter): Build in the stackable-devel image
I used opa for inspiration.
1 parent 6841bbe commit ec9bacb

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

shared/statsd-exporter/Dockerfile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,21 @@
44
ARG GOLANG_VERSION
55
FROM oci.stackable.tech/sdp/library/golang:${GOLANG_VERSION} AS golang-image
66

7+
FROM local-image/stackable-devel AS statsd-exporter-builder
8+
79
ARG PRODUCT_VERSION
10+
ARG CYCLONEDX_GOMOD_VERSION
811
ARG STACKABLE_USER_UID
12+
ARG TARGETARCH
13+
ARG TARGETOS
14+
15+
ENV CYCLONEDX_GOMOD_VERSION=$CYCLONEDX_GOMOD_VERSION
16+
ENV GOARCH=$TARGETARCH
17+
ENV GOOS=$TARGETOS
918

1019
WORKDIR /statsd_exporter
1120

12-
RUN --mount=type=cache,id=go-statsd-exporter,uid=${STACKABLE_USER_UID},target=/go_cache <<EOF
21+
RUN <<EOF
1322
microdnf update
1423

1524
# Tar and gzip are used to unpack the statsd_exporter source
@@ -21,10 +30,15 @@ microdnf install \
2130

2231
microdnf clean all
2332
rm -rf /var/cache/yum
33+
EOF
34+
35+
# Manually install Go since the dnf package is sometimes not recent enough
36+
COPY --from=golang-image /usr/local/go/ /usr/local/go/
37+
ENV PATH="/usr/local/go/bin:${PATH}"
2438

39+
RUN --mount=type=cache,id=go-statsd-exporter,uid=${STACKABLE_USER_UID},target=/go_cache <<EOF
2540
export GOPATH=/go_cache
26-
# We use version 1.7.0, since a newer version of cyclonedx-gomod is not compatible with the version of Golang (>= 1.23.1)
27-
go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v1.7.0
41+
go install "github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v${CYCLONEDX_GOMOD_VERSION}"
2842

2943
curl "https://repo.stackable.tech/repository/packages/statsd_exporter/statsd_exporter-${PRODUCT_VERSION}.src.tar.gz" | tar -xzC .
3044
(

shared/statsd-exporter/boil-config.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
# Mirror golang (no `v` prefix) via https://github.com/stackabletech/docker-images/actions/workflows/mirror.yaml
88
# Note: currently mirrored to the `sdp` project, but should probably move elsewhere.
99
golang-version = "1.22.12"
10+
# We use version 1.7.0, since a newer version of cyclonedx-gomod is not compatible with the version of Golang (>= 1.23.1)
11+
cyclonedx-gomod-version = "1.7.0"
1012

1113
[versions."0.28.0".local-images]
12-
stackable-base = "1.0.0"
14+
stackable-devel = "1.0.0"

0 commit comments

Comments
 (0)