Skip to content

Commit 711b82b

Browse files
author
Raghavendra K
committed
dockerfile: pin gcc base image to version 13
1 parent 8237adc commit 711b82b

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

Dockerfile

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
1-
# === Stage 1: Build DRBD utilities ===
21
FROM --platform=$TARGETPLATFORM gcc:13 as utils-builder
32

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
164

175
ARG DRBD_UTILS_VERSION=9.27.0
186
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
219
&& make tools \
2210
&& mv user/v9/drbdsetup /drbdsetup
2311

24-
# === Stage 2: Build Go binary ===
2512
FROM --platform=$BUILDPLATFORM golang:1 as go-builder
2613

2714
WORKDIR /work
2815
COPY go.mod go.sum /work/
16+
2917
RUN go mod download -x
3018

3119
COPY main.go main.go
@@ -34,19 +22,12 @@ COPY pkg/ pkg/
3422
ARG VERSION=devel
3523
ARG TARGETARCH
3624
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
4226

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
4528

46-
# Copy only the built binaries from previous stages
4729
COPY --from=utils-builder /drbdsetup /usr/local/sbin/drbdsetup
4830
COPY --from=go-builder /work/drbd-shutdown-guard /usr/local/sbin/drbd-shutdown-guard
4931

50-
# Define the binary to run
5132
ENV DRBDSETUP_LOCATION=/usr/local/sbin/drbdsetup
5233
CMD ["/usr/local/sbin/drbd-shutdown-guard", "install"]

0 commit comments

Comments
 (0)