separate agent dockerfiles

This commit is contained in:
henrygd
2025-08-03 21:14:43 -04:00
parent 99c7f7bd8a
commit e11d452d91
4 changed files with 38 additions and 22 deletions

View File

@@ -17,18 +17,10 @@ RUN rm -rf /tmp/*
# --------------------------
# Final image: default scratch-based agent
# --------------------------
FROM scratch AS default-agent
FROM scratch
COPY --from=builder /agent /agent
# this is so we don't need to create the /tmp directory in the scratch container
COPY --from=builder /tmp /tmp
ENTRYPOINT ["/agent"]
# --------------------------
# Final image: GPU-enabled agent with nvidia-smi
# --------------------------
FROM nvidia/cuda:12.9.0-base-ubuntu22.04 AS nvidia-agent
COPY --from=builder /agent /agent
COPY --from=builder /tmp /tmp
ENTRYPOINT ["/agent"]
ENTRYPOINT ["/agent"]

View File

@@ -0,0 +1,21 @@
FROM --platform=$BUILDPLATFORM golang:alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
# RUN go mod download
COPY *.go ./
COPY cmd ./cmd
COPY internal ./internal
# Build
ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 GOGC=75 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-w -s" -o /agent ./cmd/agent
# --------------------------
# Final image: GPU-enabled agent with nvidia-smi
# --------------------------
FROM nvidia/cuda:12.9.1-base-ubuntu22.04
COPY --from=builder /agent /agent
ENTRYPOINT ["/agent"]