FROM golang:1.10-alpine3.8 RUN apk add --no-cache \ file \ gnupg WORKDIR /usr/src/bashbrew ENV GOPATH /usr/src/bashbrew:/usr/src/bashbrew/vendor ENV CGO_ENABLED 0 ENV BASHBREW_ARCHES \ amd64 \ arm32v5 \ arm32v6 \ arm32v7 \ arm64v8 \ darwin-amd64 \ i386 \ ppc64le \ s390x \ windows-amd64 COPY .bashbrew-arch-to-goenv.sh /usr/local/bin/ # https://github.com/estesp/manifest-tool/releases ENV MANIFEST_TOOL_VERSION 0.9.0 # gpg: key 0F386284C03A1162: public key "Philip Estes " imported ENV MANIFEST_TOOL_GPG_KEY 27F3EA268A97867EAF0BD05C0F386284C03A1162 RUN set -euxo pipefail; \ \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$MANIFEST_TOOL_GPG_KEY"; \ \ mkdir -p bin; \ \ for bashbrewArch in $BASHBREW_ARCHES; do \ ( \ goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \ srcBin="manifest-tool-$GOOS-$GOARCH"; \ if [ "$GOARCH" = 'arm' ]; then [ -n "$GOARM" ]; srcBin="${srcBin}v$GOARM"; fi; \ [ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \ srcBin="$srcBin$ext"; \ targetBin="bin/manifest-tool-$bashbrewArch$ext"; \ wget -O "$targetBin.asc" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/$srcBin.asc"; \ wget -O "$targetBin" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/$srcBin"; \ gpg --batch --verify "$targetBin.asc" "$targetBin"; \ ls -lAFh "$targetBin"*; \ file "$targetBin"*; \ ) \ done; \ \ gpgconf --kill all; \ rm -r "$GNUPGHOME"; \ \ ls -lAFh bin/manifest-tool-*; \ file bin/manifest-tool-* COPY go . RUN set -euxo pipefail; \ \ mkdir -p bin; \ \ for bashbrewArch in $BASHBREW_ARCHES; do \ ( \ goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \ [ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \ \ targetBin="bin/bashbrew-$bashbrewArch$ext"; \ go build \ -a -v \ -ldflags '-s -w' \ -tags netgo -installsuffix netgo \ -o "$targetBin" \ ./src/bashbrew \ ; \ ls -lAFh "$targetBin"; \ file "$targetBin"; \ ) \ done; \ \ ls -lAFh bin/bashbrew-*; \ file bin/bashbrew-*