Add simple Dockerfile for cross-building bashbrew

This commit is contained in:
Tianon Gravi 2017-05-02 14:36:56 -07:00
parent 24ac7970ec
commit 362855e06f
2 changed files with 52 additions and 0 deletions

8
.dockerignore Normal file
View File

@ -0,0 +1,8 @@
*.md
*.sh
.dockerignore
Dockerfile*
go/bin
go/pkg
go/vendor/bin
go/vendor/pkg

44
Dockerfile.release Normal file
View File

@ -0,0 +1,44 @@
FROM golang:1.8-alpine
RUN apk add --no-cache \
file \
libressl
WORKDIR /usr/src/bashbrew
ENV GOPATH /usr/src/bashbrew:/usr/src/bashbrew/vendor
ENV CGO_ENABLED 0
# https://github.com/estesp/manifest-tool/releases
ENV MANIFEST_TOOL_VERSION 0.4.0
COPY go .
RUN set -ex; \
mkdir bin; \
for osArch in \
darwin/amd64 \
linux/amd64 \
linux/arm64 \
linux/ppc64le \
linux/s390x \
windows/amd64 \
; do \
os="${osArch%%/*}"; \
arch="${osArch#$os/}"; \
# TODO GOARM
\
[ "$os" = 'windows' ] && ext='.exe' || ext=''; \
\
GOOS="$os" GOARCH="$arch" \
go build \
-a -v \
-ldflags '-s -w' \
-tags netgo -installsuffix netgo \
-o "bin/bashbrew-$os-$arch$ext" \
./src/bashbrew; \
\
# TODO verify GPG signatures for manifest-tool releases
wget -O "bin/manifest-tool-$os-$arch$ext" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/manifest-tool-$os-$arch$ext"; \
done; \
ls -l bin; \
file bin/*