cli.Dockerfile 834 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # syntax=docker/dockerfile:1.1.7-experimental
  2. # Base Go environment
  3. # -------------------
  4. # pinned because of https://github.com/moby/moby/issues/45935
  5. FROM golang:1.20.5 as base
  6. WORKDIR /porter
  7. RUN apt-get update && apt-get install -y gcc musl-dev git make
  8. COPY go.mod go.sum ./
  9. COPY Makefile .
  10. COPY /cli ./cli
  11. COPY /internal ./internal
  12. COPY /api ./api
  13. COPY /pkg ./pkg
  14. COPY /provisioner ./provisioner
  15. RUN --mount=type=cache,target=$GOPATH/pkg/mod \
  16. go mod download
  17. # Go build environment
  18. # --------------------
  19. FROM base AS build-go
  20. ARG version=production
  21. RUN make build-cli
  22. # Deployment environment
  23. # ----------------------
  24. FROM ubuntu:latest
  25. RUN apt-get update && apt-get install -y ca-certificates
  26. COPY --from=build-go /porter/bin/porter .
  27. RUN chmod +x ./porter && mv ./porter /usr/local/bin/
  28. ENTRYPOINT ["porter"]