Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
69 lines (55 sloc)
2.24 KB
This file contains 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 golang:1.18-buster AS builder | |
| MAINTAINER Hector Sanjuan <hector@protocol.ai> | |
| # This dockerfile builds and runs ipfs-cluster-service. | |
| ENV GOPATH /go | |
| ENV SRC_PATH $GOPATH/src/github.com/ipfs-cluster/ipfs-cluster | |
| ENV GO111MODULE on | |
| ENV GOPROXY https://proxy.golang.org | |
| ENV SUEXEC_VERSION v0.2 | |
| ENV TINI_VERSION v0.19.0 | |
| RUN set -eux; \ | |
| dpkgArch="$(dpkg --print-architecture)"; \ | |
| case "${dpkgArch##*-}" in \ | |
| "amd64" | "armhf" | "arm64") tiniArch="tini-static-$dpkgArch" ;;\ | |
| *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ | |
| esac; \ | |
| cd /tmp \ | |
| && git clone https://github.com/ncopa/su-exec.git \ | |
| && cd su-exec \ | |
| && git checkout -q $SUEXEC_VERSION \ | |
| && make su-exec-static \ | |
| && cd /tmp \ | |
| && wget -q -O tini https://github.com/krallin/tini/releases/download/$TINI_VERSION/$tiniArch \ | |
| && chmod +x tini | |
| # Get the TLS CA certificates, they're not provided by busybox. | |
| RUN apt-get update && apt-get install -y ca-certificates | |
| COPY --chown=1000:users go.* $SRC_PATH/ | |
| WORKDIR $SRC_PATH | |
| RUN go mod download | |
| COPY --chown=1000:users . $SRC_PATH | |
| RUN make install | |
| #------------------------------------------------------ | |
| FROM busybox:1-glibc | |
| MAINTAINER Hector Sanjuan <hector@protocol.ai> | |
| ENV GOPATH /go | |
| ENV SRC_PATH /go/src/github.com/ipfs-cluster/ipfs-cluster | |
| ENV IPFS_CLUSTER_PATH /data/ipfs-cluster | |
| ENV IPFS_CLUSTER_CONSENSUS crdt | |
| ENV IPFS_CLUSTER_DATASTORE leveldb | |
| 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-ctl /usr/local/bin/ipfs-cluster-ctl | |
| COPY --from=builder $GOPATH/bin/ipfs-cluster-follow /usr/local/bin/ipfs-cluster-follow | |
| COPY --from=builder $SRC_PATH/docker/entrypoint.sh /usr/local/bin/entrypoint.sh | |
| COPY --from=builder /tmp/su-exec/su-exec-static /sbin/su-exec | |
| COPY --from=builder /tmp/tini /sbin/tini | |
| COPY --from=builder /etc/ssl/certs /etc/ssl/certs | |
| RUN mkdir -p $IPFS_CLUSTER_PATH && \ | |
| adduser -D -h $IPFS_CLUSTER_PATH -u 1000 -G users ipfs && \ | |
| chown ipfs:users $IPFS_CLUSTER_PATH | |
| VOLUME $IPFS_CLUSTER_PATH | |
| ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"] | |
| # Defaults for ipfs-cluster-service go here | |
| CMD ["daemon"] |