mirror of
https://github.com/henrygd/beszel.git
synced 2025-10-30 18:17:13 +00:00
28 lines
694 B
Plaintext
28 lines
694 B
Plaintext
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
|
|
|
|
# --------------------------
|
|
# Final image
|
|
# Note: must cap_add: [CAP_PERFMON] and mount /dev/dri/ as volume
|
|
# --------------------------
|
|
FROM alpine:edge
|
|
|
|
COPY --from=builder /agent /agent
|
|
|
|
RUN apk add --no-cache -X https://dl-cdn.alpinelinux.org/alpine/edge/testing igt-gpu-tools
|
|
|
|
# Ensure data persistence across container recreations
|
|
VOLUME ["/var/lib/beszel-agent"]
|
|
|
|
ENTRYPOINT ["/agent"] |