add build script file.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
9370c7f049
commit
3114d1b2f8
8
Makefile
8
Makefile
|
@ -8,14 +8,10 @@ BUILD_IMAGE := "gopush-build"
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
build: clean
|
build: clean
|
||||||
for GOOS in darwin linux windows; do \
|
sh script/build.sh
|
||||||
for GOARCH in 386 amd64; do \
|
|
||||||
GOOS=$$GOOS GOARCH=$$GOARCH go build -ldflags="-w" -o bin/$$GOOS/$$GOARCH/gopush gopush.go; \
|
|
||||||
done \
|
|
||||||
done
|
|
||||||
|
|
||||||
docker_build: clean
|
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 build -t $(BUILD_IMAGE) -f docker/Dockerfile.build .
|
||||||
docker run $(BUILD_IMAGE) > bin.tar.gz
|
docker run $(BUILD_IMAGE) > bin.tar.gz
|
||||||
tar -zxvf bin.tar.gz
|
tar -zxvf bin.tar.gz
|
||||||
|
|
|
@ -6,9 +6,6 @@ RUN mkdir -p /tmp/build
|
||||||
Add build.tar.gz /tmp/build/
|
Add build.tar.gz /tmp/build/
|
||||||
WORKDIR /tmp/build
|
WORKDIR /tmp/build
|
||||||
RUN go get -d
|
RUN go get -d
|
||||||
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w" -o bin/linux/amd64/gopush gopush.go
|
RUN sh script/build.sh
|
||||||
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
|
|
||||||
|
|
||||||
CMD tar -czf - bin
|
CMD tar -czf - bin
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue