support linux and windows bin files.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
9c8c0e08df
commit
96c04cb7a1
|
@ -26,3 +26,4 @@ _testmain.go
|
||||||
gin-bin
|
gin-bin
|
||||||
key.pem
|
key.pem
|
||||||
config.yaml
|
config.yaml
|
||||||
|
bin/*
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
.PHONY: all
|
||||||
|
|
||||||
|
VERSION=0.0.1
|
||||||
|
|
||||||
|
DEPS := $(wildcard *.go)
|
||||||
|
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
|
||||||
|
|
||||||
|
docker_build: clean
|
||||||
|
tar -zcvf build.tar.gz gopush.go gopush
|
||||||
|
docker build -t $(BUILD_IMAGE) -f docker/Dockerfile.build .
|
||||||
|
docker run $(BUILD_IMAGE) > bin.tar.gz
|
||||||
|
-rm -rf build.tar.gz
|
||||||
|
tar -zxvf bin.tar.gz
|
||||||
|
-rm -rf bin.tar.gz
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build.tar.gz bin.tar.gz bin/*
|
|
@ -0,0 +1,14 @@
|
||||||
|
FROM golang:1.6
|
||||||
|
|
||||||
|
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
CMD tar -czf - bin
|
Loading…
Reference in New Issue