diff --git a/Dockerfile b/Dockerfile index 92f175c5aed..a4773cd202c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -FROM alpine:3.2 +FROM alpine:3.3 MAINTAINER Brian Tiger Chow ENV IPFS_PATH /data/ipfs -ENV VERSION master +ENV GOPATH /go:/go/src/github.com/ipfs/go-ipfs/Godeps/_workspace EXPOSE 4001 5001 8080 # 4001 = Swarm, 5001 = API, 8080 = HTTP transport @@ -10,16 +10,19 @@ EXPOSE 4001 5001 8080 ADD bin/container_daemon /usr/local/bin/start_ipfs ADD bin/container_shacheck /usr/local/bin/shacheck +ADD . /go/src/github.com/ipfs/go-ipfs +WORKDIR /go/src/github.com/ipfs/go-ipfs/cmd/ipfs + RUN adduser -D -h /data -u 1000 ipfs \ && mkdir -p /data/ipfs && chown ipfs:ipfs /data/ipfs \ - && apk add --update bash curl wget ca-certificates zip \ - && wget https://gobuilder.me/get/github.com/ipfs/go-ipfs/cmd/ipfs/ipfs_${VERSION}_linux-386.zip \ - && /bin/bash /usr/local/bin/shacheck ${VERSION} ipfs_${VERSION}_linux-386.zip \ - && unzip ipfs_${VERSION}_linux-386.zip \ - && rm ipfs_${VERSION}_linux-386.zip \ - && mv ipfs/ipfs /usr/local/bin/ipfs \ + && apk add --update bash ca-certificates git go \ + && go install -ldflags "-X github.com/ipfs/go-ipfs/repo/config.CurrentCommit=$(git rev-parse --short HEAD 2> /dev/null || echo unknown)" \ + && mv /go/bin/ipfs /usr/local/bin/ipfs \ && chmod 755 /usr/local/bin/start_ipfs \ - && apk del wget zip curl + && apk del --purge go git + +WORKDIR / +RUN rm -rf /go/src/github.com/ipfs/go-ipfs USER ipfs VOLUME /data/ipfs