fix: dockerfile

This commit is contained in:
d3m0k1d
2026-04-04 04:04:15 +03:00
parent c5e35b4c12
commit 2a8faaa9fe
3 changed files with 6 additions and 12 deletions
+4 -10
View File
@@ -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"]