Dockerfile 548 B

123456789101112131415
  1. FROM golang:1.19-bullseye AS builder
  2. RUN apt-get update && apt-get install -y libsystemd-dev
  3. COPY go.mod /tmp/src/
  4. COPY go.sum /tmp/src/
  5. WORKDIR /tmp/src/
  6. RUN go mod download
  7. COPY . /tmp/src/
  8. RUN CGO_ENABLED=1 go test ./...
  9. ARG VERSION=unknown
  10. RUN CGO_ENABLED=1 go install -mod=readonly -ldflags "-X main.version=$VERSION" /tmp/src
  11. FROM debian:bullseye
  12. RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
  13. COPY --from=builder /go/bin/coroot-node-agent /usr/bin/coroot-node-agent
  14. ENTRYPOINT ["coroot-node-agent"]