cli.Dockerfile 722 B

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