add alpine image + add smartmontools to intel / nvidia images

This commit is contained in:
henrygd
2025-10-25 11:59:57 -04:00
parent 40010ad9b9
commit 7f372c46db
4 changed files with 114 additions and 17 deletions

View File

@@ -0,0 +1,28 @@
FROM --platform=$BUILDPLATFORM golang:alpine AS builder
WORKDIR /app
COPY ../go.mod ../go.sum ./
RUN go mod download
# Copy source files
COPY . ./
# Build
ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 GOGC=75 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-w -s" -o /agent ./internal/cmd/agent
RUN rm -rf /tmp/*
# --------------------------
# Final image: default scratch-based agent
# --------------------------
FROM alpine:latest
COPY --from=builder /agent /agent
RUN apk add --no-cache smartmontools
# Ensure data persistence across container recreations
VOLUME ["/var/lib/beszel-agent"]
ENTRYPOINT ["/agent"]