2016-06-03 17:21:46 +00:00
|
|
|
# Build golang supervisor
|
2016-10-21 03:48:08 +00:00
|
|
|
FROM debian:jessie
|
2015-07-31 17:17:57 +00:00
|
|
|
|
2016-06-03 17:21:46 +00:00
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y \
|
2016-10-21 03:48:08 +00:00
|
|
|
build-essential \
|
|
|
|
curl \
|
2016-06-03 17:21:46 +00:00
|
|
|
rsync \
|
2016-07-06 09:29:16 +00:00
|
|
|
upx-ucl \
|
2016-06-03 17:21:46 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/
|
|
|
|
|
2016-10-21 03:48:08 +00:00
|
|
|
ENV GOLANG_VERSION 1.6.3
|
|
|
|
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
|
|
|
|
ENV GOLANG_DOWNLOAD_SHA256 cdde5e08530c0579255d6153b08fdb3b8e47caabbe717bc7bcd7561275a87aeb
|
|
|
|
|
|
|
|
COPY go-${GOLANG_VERSION}-patches /go-${GOLANG_VERSION}-patches
|
|
|
|
|
|
|
|
RUN mkdir /usr/src/go \
|
|
|
|
&& cd /usr/src/go \
|
|
|
|
&& curl -L -o go.tar.gz $GOLANG_DOWNLOAD_URL \
|
|
|
|
&& echo "${GOLANG_DOWNLOAD_SHA256} go.tar.gz" | sha256sum -c - \
|
|
|
|
&& tar xzf go.tar.gz -C /usr/local \
|
|
|
|
&& cd /usr/src \
|
|
|
|
&& rm -rf go \
|
|
|
|
&& export GOROOT_BOOTSTRAP=/usr/local/go-bootstrap \
|
|
|
|
&& cp -r /usr/local/go /usr/local/go-bootstrap \
|
|
|
|
&& cd /usr/local/go/src \
|
|
|
|
&& patch -p2 -i /go-${GOLANG_VERSION}-patches/0001-Revert-runtime-check-and-fail-early-with-a-message-i.patch \
|
|
|
|
&& patch -p2 -i /go-${GOLANG_VERSION}-patches/0002-implement-atomic-quadword-ops-with-FILD-FISTP.patch \
|
|
|
|
&& ./make.bash \
|
|
|
|
&& rm -rf /usr/local/go-bootstrap
|
|
|
|
|
|
|
|
ENV GOPATH /go
|
|
|
|
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
|
|
|
|
|
2016-06-03 17:21:46 +00:00
|
|
|
COPY . /go/src/resin-supervisor/gosuper
|
2015-07-31 17:17:57 +00:00
|
|
|
|
2016-06-03 17:21:46 +00:00
|
|
|
WORKDIR /go/src/resin-supervisor/gosuper
|
|
|
|
|
|
|
|
ENV GOOS linux
|
2016-10-21 03:48:08 +00:00
|
|
|
ENV GO386=387
|
2015-07-31 17:17:57 +00:00
|
|
|
|
2016-06-03 17:21:46 +00:00
|
|
|
ARG GOARCH=amd64
|
|
|
|
ARG GOARM=''
|
2015-07-31 17:17:57 +00:00
|
|
|
|
2016-06-03 17:21:46 +00:00
|
|
|
RUN go install -a -v ./gosuper \
|
|
|
|
&& cd /go/bin \
|
2016-07-06 09:29:16 +00:00
|
|
|
&& find -type f -name gosuper -exec mv {} /go/bin/gosuper \; \
|
|
|
|
&& upx --best /go/bin/gosuper
|
2015-07-31 17:17:57 +00:00
|
|
|
|
2016-06-03 17:21:46 +00:00
|
|
|
CMD rsync -a --delete /go/bin/gosuper /build
|