Last active
May 11, 2017 20:48
-
-
Save buddhike/93a378133b25bf389310311f9a12f536 to your computer and use it in GitHub Desktop.
Go app template with dumb-init
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM centos | |
ENV DOWNLOADS /home/downloads | |
ENV TOOLS /home/tools | |
ENV GOROOT $TOOLS/go | |
ENV GOPATH /home/go | |
ENV PATH $GOROOT/bin:$PATH | |
ENV APP [APP-NAME] | |
ADD . /home/go/src/$APP | |
RUN GO_VERSION="go1.8.linux-amd64.tar.gz" && \ | |
mkdir $TOOLS && \ | |
mkdir -p $GOPATH/src && \ | |
mkdir -p $GOROOT && \ | |
mkdir -p $DOWNLOADS && \ | |
curl -o "$DOWNLOADS/$GO_VERSION" "https://storage.googleapis.com/golang/$GO_VERSION" && \ | |
tar xz -C "$TOOLS" -f "$DOWNLOADS/$GO_VERSION" && \ | |
yum install -y git && \ | |
cd /home/go/src/$APP && \ | |
go get && \ | |
go test ./... && \ | |
go build -o /usr/bin/$APP && \ | |
cd / && \ | |
curl -o /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 | |
chmod +x /usr/local/bin/dumb-init | |
yum autoremove -y git && \ | |
yum clean all && \ | |
rm -rf $TOOLS && \ | |
rm -rf $GOPATH && \ | |
rm -rf $DOWNLOADS | |
WORKDIR / | |
ENTRYPOINT ["/usr/bin/$APP"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment