From 8283b821a16e2b52d514733076bddc610cd078d2 Mon Sep 17 00:00:00 2001 From: Denis Zheleztsov Date: Fri, 17 Feb 2017 13:31:26 +0300 Subject: [PATCH] build script --- Dockerfile | 2 +- build.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 build.sh diff --git a/Dockerfile b/Dockerfile index 74bcdc7..1e7c83f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine MAINTAINER Denis Zheleztsov -ADD zoorest /usr/bin/ +ADD out/zoorest /usr/bin/ EXPOSE 8889 diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..be27d79 --- /dev/null +++ b/build.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +cat > Dockerfile.builder < + +ENV GOPATH /usr + +RUN go get github.com/Difrex/zoorest/rest +RUN cd /usr/src/github.com/Difrex/zoorest && go get -t -v ./... + +WORKDIR /usr/src/github.com/Difrex/zoorest + +ENTRYPOINT go build -ldflags "-linkmode external -extldflags -static" && mv zoorest /out +EOF + +# Build builder +docker build -t zoorest_builder -f Dockerfile.builder . +# Build bin +docker run -ti -v $(pwd)/out:/out zoorest_builder + +case $1 in alpine) + docker build -t zoorest -f Dockerfile . + ;; + *) + ;; +esac +