2023-10-12 15:32:09 +00:00
|
|
|
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.20-bullseye AS builder
|
|
|
|
MAINTAINER Hector Sanjuan <code@hector.link>
|
2017-03-06 15:29:23 +00:00
|
|
|
|
2017-11-23 13:40:49 +00:00
|
|
|
# This dockerfile builds and runs ipfs-cluster-service.
|
2023-10-12 15:32:09 +00:00
|
|
|
ARG TARGETPLATFORM TARGETOS TARGETARCH
|
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-12-06 09:56:17 +00:00
|
|
|
ENV GOPROXY https://proxy.golang.org
|
2017-10-20 10:13:49 +00:00
|
|
|
|
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
|
2023-10-12 15:32:09 +00:00
|
|
|
RUN go mod download -x
|
2019-10-28 09:23:18 +00:00
|
|
|
|
2021-12-01 00:47:15 +00:00
|
|
|
COPY --chown=1000:users . $SRC_PATH
|
2023-01-27 12:55:38 +00:00
|
|
|
RUN git config --global --add safe.directory /go/src/github.com/ipfs-cluster/ipfs-cluster
|
2023-10-12 15:32:09 +00:00
|
|
|
|
|
|
|
ENV CGO_ENABLED 0
|
2019-10-28 09:23:18 +00:00
|
|
|
RUN make install
|
|
|
|
|
|
|
|
|
2017-10-20 10:13:49 +00:00
|
|
|
#------------------------------------------------------
|
2023-10-12 15:32:09 +00:00
|
|
|
FROM alpine:3.18
|
2017-10-20 10:13:49 +00:00
|
|
|
MAINTAINER Hector Sanjuan <hector@protocol.ai>
|
|
|
|
|
2023-10-12 15:32:09 +00:00
|
|
|
LABEL org.opencontainers.image.source=https://github.com/ipfs-cluster/ipfs-cluster
|
|
|
|
LABEL org.opencontainers.image.description="Pinset orchestration for IPFS"
|
|
|
|
LABEL org.opencontainers.image.licenses=MIT+APACHE_2.0
|
|
|
|
|
|
|
|
# Install binaries for $TARGETARCH
|
|
|
|
RUN apk add --no-cache tini su-exec ca-certificates
|
|
|
|
|
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
|
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
|
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
|
2023-10-12 15:32:09 +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"]
|