forked from ipfs-cluster/ipfs-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (40 loc) · 1.82 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.21-bullseye AS builder
MAINTAINER Hector Sanjuan <code@hector.link>
# This dockerfile builds and runs ipfs-cluster-service.
ARG TARGETPLATFORM TARGETOS TARGETARCH
ENV GOPATH /go
ENV SRC_PATH $GOPATH/src/github.com/ipfs-cluster/ipfs-cluster
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
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
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
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"]