cli.Dockerfile 738 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # syntax=docker/dockerfile:1.1.7-experimental
  2. # Base Go environment
  3. # -------------------
  4. FROM golang:1.18 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. COPY /pkg ./pkg
  13. RUN --mount=type=cache,target=$GOPATH/pkg/mod \
  14. go mod download
  15. # Go build environment
  16. # --------------------
  17. FROM base AS build-go
  18. ARG version=production
  19. RUN make build-cli
  20. # Deployment environment
  21. # ----------------------
  22. FROM ubuntu:latest
  23. RUN apt-get update && apt-get install -y ca-certificates
  24. COPY --from=build-go /porter/bin/porter .
  25. RUN chmod +x ./porter && mv ./porter /usr/local/bin/
  26. ENTRYPOINT ["porter"]