fix add version on docker build.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
d9f7c16432
commit
80e1850017
|
@ -34,3 +34,4 @@ build.tar.gz
|
||||||
gorush.tar.gz
|
gorush.tar.gz
|
||||||
gorush.db
|
gorush.db
|
||||||
vendor
|
vendor
|
||||||
|
Dockerfile.tmp
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -32,7 +32,8 @@ html:
|
||||||
|
|
||||||
docker_build: clean
|
docker_build: clean
|
||||||
tar -zcvf build.tar.gz gorush.go gorush config storage Makefile glide.lock glide.yaml
|
tar -zcvf build.tar.gz gorush.go gorush config storage Makefile glide.lock glide.yaml
|
||||||
docker build --rm -t $(BUILD_IMAGE) -f docker/Dockerfile.build .
|
sed -e "s/#VERSION#/$(VERSION)/g" docker/Dockerfile.build > docker/Dockerfile.tmp
|
||||||
|
docker build --rm -t $(BUILD_IMAGE) -f docker/Dockerfile.tmp .
|
||||||
docker run --rm $(BUILD_IMAGE) > gorush.tar.gz
|
docker run --rm $(BUILD_IMAGE) > gorush.tar.gz
|
||||||
docker build --rm -t $(PRODUCTION_IMAGE) -f docker/Dockerfile.dist .
|
docker build --rm -t $(PRODUCTION_IMAGE) -f docker/Dockerfile.dist .
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,13 @@ FROM golang:1.6-alpine
|
||||||
|
|
||||||
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
|
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
|
||||||
|
|
||||||
|
ENV VERSION #VERSION#
|
||||||
RUN apk --update add git make
|
RUN apk --update add git make
|
||||||
RUN go get github.com/Masterminds/glide && cd $GOPATH/src/github.com/Masterminds/glide && make install
|
RUN go get github.com/Masterminds/glide && cd $GOPATH/src/github.com/Masterminds/glide && make install
|
||||||
RUN mkdir -p $GOPATH/src/github.com/appleboy/gorush
|
RUN mkdir -p $GOPATH/src/github.com/appleboy/gorush
|
||||||
Add build.tar.gz $GOPATH/src/github.com/appleboy/gorush/
|
Add build.tar.gz $GOPATH/src/github.com/appleboy/gorush/
|
||||||
WORKDIR $GOPATH/src/github.com/appleboy/gorush
|
WORKDIR $GOPATH/src/github.com/appleboy/gorush
|
||||||
RUN make bundle
|
RUN make bundle
|
||||||
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/gorush gorush.go
|
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X main.Version=${VERSION}" -o bin/gorush gorush.go
|
||||||
|
|
||||||
CMD tar -C bin -czf - gorush
|
CMD tar -C bin -czf - gorush
|
||||||
|
|
Loading…
Reference in New Issue