add build script file.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-03-27 22:37:54 +08:00
parent 9370c7f049
commit 3114d1b2f8
3 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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

7
script/build.sh Executable file
View File

@ -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