forked from digicatapult/sqnc-ipfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (37 loc) · 1.08 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
# syntax=docker/dockerfile:1.5
FROM golang:1.19-alpine3.17 AS ipfs_build
ENV SRC_DIR /go/src/github.com/ipfs/go-ipfs
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then apk add --no-cache binutils-gold; fi
RUN apk add --no-cache git make bash gcc musl-dev
WORKDIR /target
ARG IPFS_TAG="v0.20.0"
RUN <<EOF
set -ex
git clone --branch $IPFS_TAG https://github.com/ipfs/go-ipfs.git $SRC_DIR
cd $SRC_DIR
make build
cp $SRC_DIR/cmd/ipfs/ipfs /target/ipfs
rm -rf $SRC_DIR
EOF
FROM node:lts-alpine3.17 AS runtime
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then apk add --no-cache python3 make g++; fi
RUN apk add --no-cache curl
RUN npm i -g npm@latest
ARG LOGLEVEL
ENV NPM_CONFIG_LOGLEVEL ${LOGLEVEL}
COPY --from=ipfs_build /target /usr/local/bin
WORKDIR /dscp-ipfs
# Install base dependencies
COPY . .
RUN npm ci --production
ENV IPFS_PATH=/ipfs
# Expose 80 for healthcheck
EXPOSE 80
# Expose 4001 for ipfs swarm
EXPOSE 4001
# expose 5001 for ipfs api
EXPOSE 5001
HEALTHCHECK CMD curl --fail http://localhost:80/health || exit 1
ENTRYPOINT [ "./app/index.js" ]