Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building IPFS locally so local stack works on mac #941

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ services:

ipfs:
hostname: ipfs
# If building from Mac, comment out build and uncomment image
build:
context: ./docker/images/ipfs
dockerfile: ./Dockerfile
Expand Down
41 changes: 38 additions & 3 deletions docker/images/ipfs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,45 @@
ARG IPFS_VERSION=0.18.0

# Building IPFS binary
FROM golang:1.19.1-buster AS builder

ARG IPFS_VERSION=0.18.0
ARG IPFS_DS_S3_PLUGIN_VERSION=0cc3de579103f6fd209c30e43abadf80f1024151
ARG IPFS_HEALTHCHECK_PLUGIN_VERSION=3aaefbe9799465dcfbb89d6c68d1c4bd876f3361

WORKDIR /

# Kubo build process
# See details: https://github.com/ipfs/go-ds-s3
ENV GO111MODULE on
ENV GOPROXY direct

# We clone Kubo source code
RUN git clone --depth 1 -b v${IPFS_VERSION} https://github.com/ipfs/kubo
ENV SRC_DIR /kubo

# Move to kubo folder
WORKDIR $SRC_DIR

# Install the plugin and build ipfs
RUN go get github.com/ceramicnetwork/go-ipfs-healthcheck/plugin@${IPFS_HEALTHCHECK_PLUGIN_VERSION}
RUN echo "\nhealthcheck github.com/ceramicnetwork/go-ipfs-healthcheck/plugin 0" >> plugin/loader/preload_list
RUN go get github.com/3box/go-ds-s3/plugin@${IPFS_DS_S3_PLUGIN_VERSION}
RUN echo "\ns3ds github.com/3box/go-ds-s3/plugin 0" >> plugin/loader/preload_list
RUN make build
RUN go mod tidy
RUN CGO_ENABLED=0 make build
RUN make install

# IPFS container with all the utilities
FROM ipfs/kubo:v${IPFS_VERSION} AS ipfs-with-utils

# # Copy custom IPFS binary with s3ds and healthcheck plugin
# COPY --from=ceramicnetwork/go-ipfs-daemon:daaf07a9dbd007a3a6378f34f2a404992ade5e93 /usr/local/bin/ipfs /usr/local/bin/ipfs

# Copy IPFS from locally build IPFS binary from builder
COPY --from=builder /go/bin/ipfs /usr/local/bin/ipfs

# Copy jq
COPY --from=ghcr.io/jqlang/jq /jq /usr/local/bin/jq

Expand All @@ -16,9 +54,6 @@ COPY container-init.d container-init.d
RUN chown ipfs: /container-init.d/*.sh
RUN chown ipfs: /data/ipfs

# Copy custom IPFS binary with s3ds and healthcheck plugin
COPY --from=ceramicnetwork/go-ipfs-daemon:daaf07a9dbd007a3a6378f34f2a404992ade5e93 /usr/local/bin/ipfs /usr/local/bin/ipfs

USER ipfs

FROM scratch
Expand Down