-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (35 loc) · 1.55 KB
/
Dockerfile
File metadata and controls
43 lines (35 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# syntax=docker/dockerfile:1.20.0@sha256:26147acbda4f14c5add9946e2fd2ed543fc402884fd75146bd342a7f6271dc1d
# check=error=true
FROM local-image/stackable-base
ARG PRODUCT_VERSION
ARG STACKABLE_USER_UID
WORKDIR /statsd_exporter
RUN --mount=type=cache,id=go-statsd-exporter,uid=${STACKABLE_USER_UID},target=/go_cache <<EOF
microdnf update
# Tar and gzip are used to unpack the statsd_exporter source
# Golang is used to build statsd_exporter
# Git is needed by the cyclonedx-gomod tool to determine the version of statsd_exporter
microdnf install \
tar \
gzip \
git \
golang
microdnf clean all
rm -rf /var/cache/yum
export GOPATH=/go_cache
# We use version 1.7.0, since a newer version of cyclonedx-gomod is not compatible with the version of Golang (>= 1.23.1)
go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v1.7.0
curl "https://repo.stackable.tech/repository/packages/statsd_exporter/statsd_exporter-${PRODUCT_VERSION}.src.tar.gz" | tar -xzC .
(
cd "statsd_exporter-${PRODUCT_VERSION}" || exit
# Unfortunately, we need to create a dummy Git repository to allow cyclonedx-gomod to determine the version of statsd_exporter
git init
git config user.email "fake.commiter@stackable.tech"
git config user.name "Fake commiter"
git commit --allow-empty --message "Fake commit, so that we can create a tag"
git tag "v${PRODUCT_VERSION}"
go build -o ../statsd_exporter
$GOPATH/bin/cyclonedx-gomod app -json -output-version 1.5 -output ../statsd_exporter-${PRODUCT_VERSION}.cdx.json -packages -files
)
rm -rf "statsd_exporter-${PRODUCT_VERSION}"
EOF