From 49976c6f61fb2853d47655c464369b74bd6b9bef Mon Sep 17 00:00:00 2001 From: henrygd Date: Wed, 17 Sep 2025 14:10:02 -0400 Subject: [PATCH] fix nvidia agent dockerfile after project reorganization --- internal/dockerfile_agent_nvidia | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/internal/dockerfile_agent_nvidia b/internal/dockerfile_agent_nvidia index e1578794..36c21e85 100644 --- a/internal/dockerfile_agent_nvidia +++ b/internal/dockerfile_agent_nvidia @@ -2,15 +2,18 @@ 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 + +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 ./cmd/agent +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: GPU-enabled agent with nvidia-smi @@ -18,4 +21,7 @@ RUN CGO_ENABLED=0 GOGC=75 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "- FROM nvidia/cuda:12.2.2-base-ubuntu22.04 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"]