1d256166d6
After changes on how the final docker image for go-ipfs is generated, our Dockerfiles failed to build. The new version is inspired on go-ipfs Dockerfile. It takes advantage of docker >= v17.06 which allows multi-stage Dockerfiles with several FROM directives and COPY --from. This allows build freely on a first stage, without thinking of cleaning up, and then just copy the final artifacts to a second, minimal image. The Dockerfile-test is similarly updated. Minor changes have been applied to the entrypoints. License: MIT Signed-off-by: Hector Sanjuan <hector@protocol.ai>
43 lines
1.4 KiB
Plaintext
43 lines
1.4 KiB
Plaintext
FROM golang:1.9-stretch AS builder
|
|
MAINTAINER Hector Sanjuan <hector@protocol.ai>
|
|
|
|
# This build state just builds the cluster binaries
|
|
|
|
ENV GOPATH /go
|
|
ENV SRC_PATH $GOPATH/src/github.com/ipfs/ipfs-cluster
|
|
|
|
COPY . $SRC_PATH
|
|
WORKDIR $SRC_PATH
|
|
RUN make install
|
|
|
|
#------------------------------------------------------
|
|
FROM ipfs/go-ipfs
|
|
MAINTAINER Hector Sanjuan <hector@protocol.ai>
|
|
|
|
# This is the container which just puts the previously
|
|
# built binaries on the go-ipfs-container.
|
|
|
|
ENV GOPATH /go
|
|
ENV SRC_PATH /go/src/github.com/ipfs/ipfs-cluster
|
|
ENV IPFS_CLUSTER_PATH /data/ipfs-cluster
|
|
|
|
EXPOSE 9094
|
|
EXPOSE 9095
|
|
EXPOSE 9096
|
|
|
|
COPY --from=builder $GOPATH/bin/ipfs-cluster-service /usr/local/bin/ipfs-cluster-service
|
|
COPY --from=builder $GOPATH/bin/ipfs-cluster-service /usr/local/bin/ipfs-cluster-ctl
|
|
COPY --from=builder $SRC_PATH/docker/test-entrypoint.sh /usr/local/bin/start-daemons.sh
|
|
COPY --from=builder $SRC_PATH/docker/random-stopper.sh /usr/local/bin/random-stopper.sh
|
|
COPY --from=builder $SRC_PATH/docker/random-killer.sh /usr/local/bin/random-killer.sh
|
|
COPY --from=builder $SRC_PATH/docker/wait-killer-stopper.sh /usr/local/bin/wait-killer-stopper.sh
|
|
COPY --from=builder $SRC_PATH/docker/cluster-restart.sh /usr/local/bin/cluster-restart.sh
|
|
|
|
RUN mkdir -p $IPFS_CLUSTER_PATH && \
|
|
chown 1000:100 $IPFS_CLUSTER_PATH
|
|
|
|
VOLUME $IPFS_CLUSTER_PATH
|
|
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/start-daemons.sh"]
|
|
|
|
CMD ["$IPFS_CLUSTER_OPTS"]
|