From 3114d1b2f8de8b2e03025309559b7ae2000c1efe Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 27 Mar 2016 22:37:54 +0800 Subject: [PATCH] add build script file. Signed-off-by: Bo-Yi Wu --- Makefile | 8 ++------ docker/Dockerfile.build | 5 +---- script/build.sh | 7 +++++++ 3 files changed, 10 insertions(+), 10 deletions(-) create mode 100755 script/build.sh diff --git a/Makefile b/Makefile index dad2c09..0f62656 100644 --- a/Makefile +++ b/Makefile @@ -8,14 +8,10 @@ BUILD_IMAGE := "gopush-build" all: build build: clean - for GOOS in darwin linux windows; do \ - for GOARCH in 386 amd64; do \ - GOOS=$$GOOS GOARCH=$$GOARCH go build -ldflags="-w" -o bin/$$GOOS/$$GOARCH/gopush gopush.go; \ - done \ - done + sh script/build.sh docker_build: clean - tar -zcvf build.tar.gz gopush.go gopush + tar -zcvf build.tar.gz gopush.go gopush script docker build -t $(BUILD_IMAGE) -f docker/Dockerfile.build . docker run $(BUILD_IMAGE) > bin.tar.gz tar -zxvf bin.tar.gz diff --git a/docker/Dockerfile.build b/docker/Dockerfile.build index e57e8ec..0a84a47 100644 --- a/docker/Dockerfile.build +++ b/docker/Dockerfile.build @@ -6,9 +6,6 @@ RUN mkdir -p /tmp/build Add build.tar.gz /tmp/build/ WORKDIR /tmp/build RUN go get -d -RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w" -o bin/linux/amd64/gopush gopush.go -RUN GOOS=darwin GOARCH=amd64 go build -ldflags="-w" -o bin/darwin/amd64/gopush gopush.go -RUN GOOS=windows GOARCH=386 go build -ldflags="-w" -o bin/windows/i386/gopush.exe gopush.go -RUN GOOS=windows GOARCH=amd64 go build -ldflags="-w" -o bin/windows/amd64/gopush.exe gopush.go +RUN sh script/build.sh CMD tar -czf - bin diff --git a/script/build.sh b/script/build.sh new file mode 100755 index 0000000..b1e3beb --- /dev/null +++ b/script/build.sh @@ -0,0 +1,7 @@ +#!/bin/sh +for GOOS in darwin linux windows; do + for GOARCH in 386 amd64; do + echo "Build: ${GOOS}, Arch: ${GOARCH}" + GOOS=$GOOS GOARCH=$GOARCH go build -ldflags="-w" -o bin/$GOOS/$GOARCH/gopush gopush.go; + done +done