Skip to content

Commit 3d6bc5f

Browse files
committed
Many fixes to try
1 parent 9af44b2 commit 3d6bc5f

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

vmhub5_exporter/Dockerfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
# Start with the official Golang image for building the binary
2-
FROM golang:1.23 as builder
2+
FROM --platform=${TARGETPLATFORM} golang:1.23 as builder
33

44
# Set the working directory inside the container
55
WORKDIR /app
66

7+
ENV CGO_ENABLED=0
8+
79
# Copy go.mod and go.sum first to cache dependencies
810
COPY go.mod go.sum ./
9-
RUN go mod download
11+
RUN go mod download -x
1012

1113
# Copy the source code
1214
COPY . .
1315

1416
# Build the application
15-
RUN go build -o vmhub5_exporter .
17+
# RUN go build -ldflags="-s -w" -o vmhub5_exporter .
18+
RUN go build -ldflags="-s -w -extldflags '-static'" -o vmhub5_exporter .
19+
1620

1721
# Start a new minimal image for running the application
18-
FROM alpine:latest
22+
FROM --platform=${TARGETPLATFORM} alpine:latest
1923

2024
# Install CA certificates to allow HTTPS connections
2125
RUN apk --no-cache add ca-certificates
2226

2327
# Copy the compiled binary from the builder stage
24-
COPY --from=builder /app/vmhub5_exporter /usr/local/bin/vmhub5_exporter
28+
COPY --chmod=755 --from=builder /app/vmhub5_exporter /usr/local/bin/vmhub5_exporter
2529

2630
# Set the port the container will expose
2731
EXPOSE 8080

vmhub5_exporter/PLATFORMS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
linux/arm/v7
21
linux/arm64
32
linux/amd64

vmhub5_exporter/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.0.2
1+
0.0.0.5

0 commit comments

Comments
 (0)