This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
generated from ipfs/ipfs-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathDockerfile
46 lines (33 loc) · 1.58 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
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.20-bullseye AS builder
# This builds bifrost-gateway
ARG TARGETPLATFORM TARGETOS TARGETARCH
ENV GOPATH /go
ENV SRC_PATH $GOPATH/src/github.com/ipfs/bifrost-gateway
ENV GO111MODULE on
ENV GOPROXY https://proxy.golang.org
COPY go.* $SRC_PATH/
WORKDIR $SRC_PATH
RUN go mod download
COPY . $SRC_PATH
RUN git config --global --add safe.directory /go/src/github.com/ipfs/bifrost-gateway
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o $GOPATH/bin/bifrost-gateway
#------------------------------------------------------
FROM alpine:3.18
# This runs bifrost-gateway
# Instal binaries for $TARGETARCH
RUN apk add --no-cache tini su-exec ca-certificates
ENV GOPATH /go
ENV SRC_PATH $GOPATH/src/github.com/ipfs/bifrost-gateway
ENV BIFROST_GATEWAY_PATH /data/bifrost-gateway
ENV KUBO_RPC_URL https://node0.delegate.ipfs.io,https://node1.delegate.ipfs.io,https://node2.delegate.ipfs.io,https://node3.delegate.ipfs.io
COPY --from=builder $GOPATH/bin/bifrost-gateway /usr/local/bin/bifrost-gateway
COPY --from=builder $SRC_PATH/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN mkdir -p $BIFROST_GATEWAY_PATH && \
adduser -D -h $BIFROST_GATEWAY_PATH -u 1000 -G users ipfs && \
chown ipfs:users $BIFROST_GATEWAY_PATH
VOLUME $BIFROST_GATEWAY_PATH
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"]
CMD ["--gateway-port", "8081", "--metrics-port", "8041"]