2022-05-05 21:05:08 +00:00
|
|
|
FROM golang:1.18-buster AS builder
|
2017-03-06 15:29:23 +00:00
|
|
|
MAINTAINER Hector Sanjuan <hector@protocol.ai>
|
|
|
|
|
2017-11-23 13:40:49 +00:00
|
|
|
# This dockerfile builds and runs ipfs-cluster-service.
|
2017-10-20 10:13:49 +00:00
|
|
|
|
2019-12-06 09:56:17 +00:00
|
|
|
ENV GOPATH /go
|
2022-06-15 09:19:17 +00:00
|
|
|
ENV SRC_PATH $GOPATH/src/github.com/ipfs-cluster/ipfs-cluster
|
2019-03-08 01:44:07 +00:00
|
|
|
ENV GO111MODULE on
|
2019-12-06 09:56:17 +00:00
|
|
|
ENV GOPROXY https://proxy.golang.org
|
2017-10-20 10:13:49 +00:00
|
|
|
|
2017-11-23 13:40:49 +00:00
|
|
|
ENV SUEXEC_VERSION v0.2
|
2020-07-22 15:43:56 +00:00
|
|
|
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 \
|
2017-11-23 13:40:49 +00:00
|
|
|
&& git clone https://github.com/ncopa/su-exec.git \
|
|
|
|
&& cd su-exec \
|
|
|
|
&& git checkout -q $SUEXEC_VERSION \
|
2020-07-22 15:43:56 +00:00
|
|
|
&& make su-exec-static \
|
2017-11-23 13:40:49 +00:00
|
|
|
&& cd /tmp \
|
2020-07-22 15:43:56 +00:00
|
|
|
&& wget -q -O tini https://github.com/krallin/tini/releases/download/$TINI_VERSION/$tiniArch \
|
2017-11-23 13:40:49 +00:00
|
|
|
&& chmod +x tini
|
|
|
|
|
2019-03-24 01:56:40 +00:00
|
|
|
# Get the TLS CA certificates, they're not provided by busybox.
|
|
|
|
RUN apt-get update && apt-get install -y ca-certificates
|
|
|
|
|
2021-12-01 00:47:15 +00:00
|
|
|
COPY --chown=1000:users go.* $SRC_PATH/
|
2019-10-28 09:23:18 +00:00
|
|
|
WORKDIR $SRC_PATH
|
|
|
|
RUN go mod download
|
|
|
|
|
2021-12-01 00:47:15 +00:00
|
|
|
COPY --chown=1000:users . $SRC_PATH
|
2019-10-28 09:23:18 +00:00
|
|
|
RUN make install
|
|
|
|
|
|
|
|
|
2017-10-20 10:13:49 +00:00
|
|
|
#------------------------------------------------------
|
2017-11-23 13:40:49 +00:00
|
|
|
FROM busybox:1-glibc
|
2017-10-20 10:13:49 +00:00
|
|
|
MAINTAINER Hector Sanjuan <hector@protocol.ai>
|
|
|
|
|
2019-12-06 09:56:17 +00:00
|
|
|
ENV GOPATH /go
|
2022-06-15 09:19:17 +00:00
|
|
|
ENV SRC_PATH /go/src/github.com/ipfs-cluster/ipfs-cluster
|
2019-12-06 09:56:17 +00:00
|
|
|
ENV IPFS_CLUSTER_PATH /data/ipfs-cluster
|
2019-08-13 12:43:07 +00:00
|
|
|
ENV IPFS_CLUSTER_CONSENSUS crdt
|
2021-06-29 13:44:24 +00:00
|
|
|
ENV IPFS_CLUSTER_DATASTORE leveldb
|
2017-03-06 15:29:23 +00:00
|
|
|
|
2017-10-20 10:13:49 +00:00
|
|
|
EXPOSE 9094
|
|
|
|
EXPOSE 9095
|
|
|
|
EXPOSE 9096
|
2017-03-06 15:29:23 +00:00
|
|
|
|
2017-10-20 10:13:49 +00:00
|
|
|
COPY --from=builder $GOPATH/bin/ipfs-cluster-service /usr/local/bin/ipfs-cluster-service
|
2017-10-25 14:15:45 +00:00
|
|
|
COPY --from=builder $GOPATH/bin/ipfs-cluster-ctl /usr/local/bin/ipfs-cluster-ctl
|
2019-12-16 14:10:11 +00:00
|
|
|
COPY --from=builder $GOPATH/bin/ipfs-cluster-follow /usr/local/bin/ipfs-cluster-follow
|
2017-11-23 13:40:49 +00:00
|
|
|
COPY --from=builder $SRC_PATH/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
|
2020-07-22 15:43:56 +00:00
|
|
|
COPY --from=builder /tmp/su-exec/su-exec-static /sbin/su-exec
|
2017-11-23 13:40:49 +00:00
|
|
|
COPY --from=builder /tmp/tini /sbin/tini
|
2019-03-24 01:56:40 +00:00
|
|
|
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
|
2017-03-06 15:29:23 +00:00
|
|
|
|
2017-10-20 10:13:49 +00:00
|
|
|
RUN mkdir -p $IPFS_CLUSTER_PATH && \
|
2017-11-23 13:40:49 +00:00
|
|
|
adduser -D -h $IPFS_CLUSTER_PATH -u 1000 -G users ipfs && \
|
|
|
|
chown ipfs:users $IPFS_CLUSTER_PATH
|
2017-03-06 15:29:23 +00:00
|
|
|
|
2017-10-20 10:13:49 +00:00
|
|
|
VOLUME $IPFS_CLUSTER_PATH
|
2017-11-23 13:40:49 +00:00
|
|
|
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"]
|
2017-03-06 15:29:23 +00:00
|
|
|
|
2018-04-26 18:02:10 +00:00
|
|
|
# Defaults for ipfs-cluster-service go here
|
2019-08-09 14:00:55 +00:00
|
|
|
CMD ["daemon"]
|