Dockerfile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright 2018 The Kubernetes Authors.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. FROM k8s.gcr.io/kube-cross:v1.13.6-1 as build_k8s_1_17_sample_apiserver
  15. ENV GOPATH /go
  16. RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
  17. ENV PATH $GOPATH/bin:$PATH
  18. # The e2e aggregator test is designed to test ability to run sample-apiserver as an aggregated server.
  19. # see e2e test named "Should be able to support the 1.17 Sample API Server using the current Aggregator"
  20. # Build v1.17.0 to ensure the current release supports a prior version of the sample apiserver
  21. # Get without building to populate module cache
  22. RUN GO111MODULE=on go get -d k8s.io/sample-apiserver@v0.17.0
  23. # Get with OS/ARCH-specific env to build
  24. RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=BASEARCH go get k8s.io/sample-apiserver@v0.17.0
  25. # for arm, go install uses go/bin/linux_arm, so just find the file and copy it to the root so
  26. # we can copy it out from this throw away container image from a standard location
  27. RUN find /go/bin -name sample-apiserver -exec cp {} / \;
  28. FROM BASEIMAGE
  29. COPY --from=build_k8s_1_17_sample_apiserver /sample-apiserver /sample-apiserver
  30. ENTRYPOINT ["/sample-apiserver"]