fix: dockerfile
This commit is contained in:
+4
-10
@@ -2,20 +2,14 @@ FROM golang:1.26.1 as builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
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 agent/ agent/
|
||||
|
||||
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 tidy && \
|
||||
CGO_ENABLED=0 go build -ldflags "-s -w" -o agent ./main.go
|
||||
go mod download && \
|
||||
CGO_ENABLED=0 go build -ldflags "-s -w" -o /agent .
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
@@ -25,6 +19,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/agent/agent .
|
||||
COPY --from=builder /agent .
|
||||
|
||||
CMD ["./agent"]
|
||||
|
||||
Reference in New Issue
Block a user