github.com/GoogleContainerTools/skaffold@v1.39.18/deploy/cross/Dockerfile (about) 1 # Copyright 2019 The Skaffold Authors All rights reserved. 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 15 FROM dockercore/golang-cross:1.13.15 as base 16 17 # Allow overriding the go toolchain version as required, though dockercore/golang-cross 18 # only supports up to macOS 10.10, and Go 1.15 requires a later version. 19 ARG GO_VERSION=1.14.14 20 21 # The base image is not yet available for go 1.15. 22 # Let's just replace the Go that's installed with a newer one. 23 RUN rm -Rf /usr/local/go && mkdir /usr/local/go 24 RUN curl --fail --show-error --silent --location https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz \ 25 | tar xz --directory=/usr/local/go --strip-components=1 26 27 # Cross compile Skaffold for Linux, Windows and MacOS 28 ARG GOOS 29 ARG GOARCH 30 ARG TAGS 31 ARG LDFLAGS 32 ARG CGO_ENABLED=1 33 34 WORKDIR /skaffold 35 COPY . ./ 36 RUN if [ "$GOOS" = "darwin" ]; then export CC=o64-clang CXX=o64-clang++; fi; \ 37 GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=$CGO_ENABLED \ 38 go build -tags "${TAGS}" -ldflags "${LDFLAGS}" -o /build/skaffold ./cmd/skaffold