This repository has been archived by the owner on Nov 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
172 lines (142 loc) · 6.03 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
ARG IPFS_VERSION=0.13.1
ARG CERAMIC_VERSION=2.3.x
ARG GLAZED_VERSION=0.2.x
ARG GETH_VERSION=1.10
ARG BITCOIN_CLI_VERSION=23.0
# prepare stage images
# ----------------------------------------------------------------------------
FROM --platform=$TARGETPLATFORM ethereum/client-go:release-${GETH_VERSION} as prepare-geth
FROM --platform=$TARGETPLATFORM ipfs/go-ipfs:v${IPFS_VERSION} as prepare-ipfs
FROM --platform=$TARGETPLATFORM alpine as prepare-bitcoin
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG BITCOIN_CLI_VERSION
# Download checksums
ADD https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_CLI_VERSION}/SHA256SUMS ./
# Download bitcoin archive
COPY docker/download_bitcoin_cli.sh /docker/download_bitcoin_cli.sh
RUN /docker/download_bitcoin_cli.sh
# minimal
# ----------------------------------------------------------------------------
FROM --platform=$TARGETPLATFORM ghcr.io/linuxserver/baseimage-ubuntu:jammy as minimal
ARG TARGETPLATFORM
ARG BUILDPLATFORM
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
LABEL org.opencontainers.image.base.name="ghcr.io/linuxserver/baseimage-ubuntu:jammy"
LABEL org.opencontainers.image.url="https://github.com/fluencelabs/nox-distro"
LABEL org.opencontainers.image.vendor="fluencelabs"
LABEL maintainer="fluencelabs"
LABEL org.opencontainers.image.authors="fluencelabs"
LABEL org.opencontainers.image.title="Fluence nox distro"
LABEL org.opencontainers.image.description="Minimal image containing only nox itself"
ENV RUST_LOG="info,aquamarine=warn,tokio_threadpool=info,tokio_reactor=info,mio=info,tokio_io=info,soketto=info,yamux=info,multistream_select=info,libp2p_secio=info,libp2p_websocket::framed=info,libp2p_ping=info,libp2p_core::upgrade::apply=info,libp2p_kad::kbucket=info,cranelift_codegen=info,wasmer_wasi=info,cranelift_codegen=info,wasmer_wasi=info"
ENV RUST_BACKTRACE="1"
## set /run_fluence as the CMD binary
ENV S6_CMD_ARG0="/run_fluence"
RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
jq \
less \
logrotate \
curl wget && \
apt-get clean && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
# install missing libssl
COPY docker/install_libssl.sh /docker/install_libssl.sh
RUN /docker/install_libssl.sh
# aqua-ipfs builtin default env variables
# instruct aqua-ipfs (client) to work with an IPFS node hosted on ipfs.fluence.dev
ENV FLUENCE_ENV_AQUA_IPFS_EXTERNAL_API_MULTIADDR=/dns4/ipfs.fluence.dev/tcp/5001
ENV FLUENCE_ENV_AQUA_IPFS_LOCAL_API_MULTIADDR=/dns4/ipfs.fluence.dev/tcp/5001
# connector[decider] builtin default env variables
# 'true' means to join all deals
# 'false' means to join no deals and disable connector completely
ENV FLUENCE_ENV_CONNECTOR_JOIN_ALL_DEALS=true
# instruct decider which api endpoint to poll
ENV FLUENCE_ENV_CONNECTOR_API_ENDPOINT=https://testnet.aurora.dev
# deal contract address
ENV FLUENCE_ENV_CONNECTOR_CONTRACT_ADDRESS=0xb497e025D3095A197E30Ca84DEc36a637E649868
# find deals from this block
ENV FLUENCE_ENV_CONNECTOR_FROM_BLOCK=0x75f3fbc
# download nox binary, builtins
COPY fluence/ /fluence/
RUN /fluence/download_fluence.sh /fluence/fluence.json
# copy default fluence config
COPY fluence/Config.default.toml /.fluence/v1/Config.toml
ENV FLUENCE_CONFIG=/.fluence/v1/Config.toml
# copy IPFS binary
COPY --from=prepare-ipfs /usr/local/bin/ipfs /usr/bin/ipfs
# copy s6 configs
COPY s6/minimal/ /
# ipfs
# ----------------------------------------------------------------------------
FROM minimal as ipfs
ARG TARGETPLATFORM
ARG BUILDPLATFORM
LABEL org.opencontainers.image.description="nox bundled with IPFS daemon"
LABEL dev.fluence.bundles.ipfs="${IPFS_VERSION}"
ENV IPFS_PATH=/config/ipfs
ENV IPFS_LOG_DIR=/log/ipfs
ENV IPFS_LOGGING_FMT=nocolor
ENV IPFS_MIGRATE_FS=false
ENV IPFS_ADDRESSES_SWARM=/ip4/0.0.0.0/tcp/4001,/ip4/0.0.0.0/tcp/4001/ws
ENV IPFS_ADDRESSES_API=/ip4/0.0.0.0/tcp/5001
ENV IPFS_ADDRESSES_GATEWAY=/ip4/0.0.0.0/tcp/8080
ENV IPFS_ADDRESSES_ANNOUNCE=/ip4/127.0.0.1/tcp/4001,/ip4/127.0.0.1/tcp/4001/ws
# aqua-ipfs builtin default env variables
# instruct aqua-ipfs (client) to work with an IPFS node hosted on 127.0.0.1 (inside this docker container)
ENV FLUENCE_ENV_AQUA_IPFS_EXTERNAL_API_MULTIADDR=/ip4/127.0.0.1/tcp/5001
ENV FLUENCE_ENV_AQUA_IPFS_LOCAL_API_MULTIADDR=/ip4/127.0.0.1/tcp/5001
# download ipfs fs-repo-migrations tool
COPY docker/download_ipfs_fs_repo_migrations.sh /docker/download_ipfs_fs_repo_migrations.sh
RUN /docker/download_ipfs_fs_repo_migrations.sh
# copy s6 configs
COPY s6/ipfs/ /
# expose IPFS node port
EXPOSE 5001
# rich
# ----------------------------------------------------------------------------
FROM ipfs as rich
ARG CERAMIC_VERSION
ARG GLAZED_VERSION
ARG GETH_VERSION
ARG BITCOIN_CLI_VERSION
ARG TARGETPLATFORM
ARG BUILDPLATFORM
LABEL org.opencontainers.image.description="nox bundled with IPFS, Ceramic CLI and other tools"
LABEL dev.fluence.image.bundles.ceramic="${CERAMIC_VERSION}"
LABEL dev.fluence.image.bundles.glazed="${GLAZED_VERSION}"
LABEL dev.fluence.image.bundles.bitcoin_cli="${BITCOIN_CLI_VERSION}"
LABEL dev.fluence.image.bundles.geth="${GETH_VERSION}"
# add nodejs 16.x repo
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor > /usr/share/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x focal main" > /etc/apt/sources.list.d/nodesource.list
RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
musl \
nodejs && \
apt-get clean && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
# install ceramic and glaze
ENV SHELL=bash
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN curl -fsSL https://get.pnpm.io/install.sh | sh -
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install --prod -g \
@ceramicnetwork/cli@$CERAMIC_VERSION \
@glazed/cli@$GLAZED_VERSION
# copy geth
COPY --from=prepare-geth /usr/local/bin/geth /usr/bin/geth
# copy bitcoin-cli
COPY --from=prepare-bitcoin /bitcoin-${BITCOIN_CLI_VERSION}/bin/bitcoin-cli /usr/bin/bitcoin-cli
# copy s6 configs
COPY s6/rich/ /