ipfs-cluster/Dockerfile

56 lines
1.8 KiB
Docker
Raw Normal View History

FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.20-bullseye AS builder
MAINTAINER Hector Sanjuan <code@hector.link>
# This dockerfile builds and runs ipfs-cluster-service.
ARG TARGETPLATFORM TARGETOS TARGETARCH
2019-12-06 09:56:17 +00:00
ENV GOPATH /go
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
COPY --chown=1000:users go.* $SRC_PATH/
WORKDIR $SRC_PATH
RUN go mod download -x
COPY --chown=1000:users . $SRC_PATH
RUN git config --global --add safe.directory /go/src/github.com/ipfs-cluster/ipfs-cluster
ENV CGO_ENABLED 0
RUN make install
#------------------------------------------------------
FROM alpine:3.18
MAINTAINER Hector Sanjuan <hector@protocol.ai>
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
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
ENV IPFS_CLUSTER_CONSENSUS crdt
EXPOSE 9094
EXPOSE 9095
EXPOSE 9096
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
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
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"]