cli.Dockerfile 660 B

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