You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FROM --platform=$TARGETPLATFORM gcc:13 as utils-builder
3
2
4
-
# Install only necessary tools in minimal environment
5
-
# - flex: needed for parsing in DRBD utils build
6
-
# - libkeyutils-dev: required by DRBD
7
-
# - curl, tar: to fetch and extract source
8
-
# - make: to compile tools
9
-
RUN apt-get update && apt-get install -y \
10
-
flex \
11
-
libkeyutils-dev \
12
-
curl \
13
-
tar \
14
-
make \
15
-
&& apt-get clean
3
+
RUN apt-get update && apt-get install -y flex libkeyutils-dev
16
4
17
5
ARG DRBD_UTILS_VERSION=9.27.0
18
6
RUN curl -fsSL "https://pkg.linbit.com/downloads/drbd/utils/drbd-utils-$DRBD_UTILS_VERSION.tar.gz" | tar -xzv \
@@ -21,11 +9,11 @@ RUN curl -fsSL "https://pkg.linbit.com/downloads/drbd/utils/drbd-utils-$DRBD_UTI
21
9
&& make tools \
22
10
&& mv user/v9/drbdsetup /drbdsetup
23
11
24
-
# === Stage 2: Build Go binary ===
25
12
FROM --platform=$BUILDPLATFORM golang:1 as go-builder
26
13
27
14
WORKDIR /work
28
15
COPY go.mod go.sum /work/
16
+
29
17
RUN go mod download -x
30
18
31
19
COPY main.go main.go
@@ -34,19 +22,12 @@ COPY pkg/ pkg/
34
22
ARG VERSION=devel
35
23
ARG TARGETARCH
36
24
ARG TARGETOS
37
-
RUN --mount=type=cache,target=/root/.cache/go-build \
38
-
CGO_ENABLED=0 \
39
-
GOOS=$TARGETOS \
40
-
GOARCH=$TARGETARCH \
41
-
go build -a -ldflags "-X github.com/piraeusdatastore/drbd-shutdown-guard/pkg/vars.Version=$VERSION" -o drbd-shutdown-guard main.go
25
+
RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -ldflags "-X github.com/piraeusdatastore/drbd-shutdown-guard/pkg/vars.Version=$VERSION" -o drbd-shutdown-guard main.go
42
26
43
-
# === Stage 3: Final minimal runtime image ===
44
-
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
27
+
FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi9/ubi:latest
45
28
46
-
# Copy only the built binaries from previous stages
0 commit comments