+9
-5
@@ -2,16 +2,20 @@ FROM golang:1.26.1 as builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
COPY agent/ agent/
|
||||
COPY proto/ proto/
|
||||
WORKDIR /app/agent
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
go mod download
|
||||
|
||||
COPY . .
|
||||
ENV CGO_ENABLED=0
|
||||
COPY agent/ agent/
|
||||
COPY proto/ proto/
|
||||
WORKDIR /app/agent
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
go build -ldflags "-s -w" -o agent ./main.go
|
||||
go mod tidy && \
|
||||
CGO_ENABLED=0 go build -ldflags "-s -w" -o agent ./main.go
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
@@ -21,6 +25,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/agent .
|
||||
COPY --from=builder /app/agent/agent .
|
||||
|
||||
CMD ["./agent"]
|
||||
|
||||
Reference in New Issue
Block a user