2020-05-26 12:04:40 +00:00
|
|
|
# BUILD IMAGE --------------------------------------------------------
|
2020-09-21 19:27:22 +00:00
|
|
|
|
2022-10-05 11:28:41 +00:00
|
|
|
FROM alpine:3.16 AS nim-build
|
2020-05-26 12:04:40 +00:00
|
|
|
|
2022-05-17 19:11:07 +00:00
|
|
|
ARG NIMFLAGS
|
2022-02-21 15:42:27 +00:00
|
|
|
ARG MAKE_TARGET=wakunode2
|
2020-05-26 12:04:40 +00:00
|
|
|
|
|
|
|
# Get build tools and required header files
|
2022-10-05 11:28:41 +00:00
|
|
|
RUN apk add --no-cache bash git cargo build-base pcre-dev linux-headers
|
|
|
|
|
|
|
|
# Install newer rust than 1.62 as required by ethers-core.
|
|
|
|
ENV PKG=rust-1.64.0-x86_64-unknown-linux-musl
|
|
|
|
RUN wget -q https://static.rust-lang.org/dist/$PKG.tar.gz \
|
|
|
|
&& tar xf $PKG.tar.gz \
|
|
|
|
&& cd $PKG \
|
|
|
|
&& ./install.sh --components=rustc,cargo,rust-std-x86_64-unknown-linux-musl \
|
|
|
|
&& cd - \
|
|
|
|
&& rm -r $PKG $PKG.tar.gz
|
2020-05-26 12:04:40 +00:00
|
|
|
|
|
|
|
WORKDIR /app
|
2020-09-21 19:27:22 +00:00
|
|
|
COPY . .
|
2020-05-26 12:04:40 +00:00
|
|
|
|
|
|
|
# Ran separately from 'make' to avoid re-doing
|
|
|
|
RUN git submodule update --init --recursive
|
|
|
|
|
2020-09-21 19:27:22 +00:00
|
|
|
# Slowest build step for the sake of caching layers
|
2022-10-05 11:28:41 +00:00
|
|
|
RUN make -j$(nproc) deps
|
2020-09-21 19:27:22 +00:00
|
|
|
|
|
|
|
# Build the final node binary
|
2022-10-05 11:28:41 +00:00
|
|
|
RUN make -j$(nproc) $MAKE_TARGET NIMFLAGS="$NIMFLAGS"
|
|
|
|
|
2020-05-26 12:04:40 +00:00
|
|
|
# ACTUAL IMAGE -------------------------------------------------------
|
2020-09-21 19:27:22 +00:00
|
|
|
|
2022-10-05 11:28:41 +00:00
|
|
|
FROM alpine:3.16
|
2020-09-21 19:27:22 +00:00
|
|
|
|
2020-10-20 02:36:27 +00:00
|
|
|
ARG MAKE_TARGET=wakunode2
|
2020-05-26 12:04:40 +00:00
|
|
|
|
|
|
|
LABEL maintainer="jakub@status.im"
|
|
|
|
LABEL source="https://github.com/status-im/nim-waku"
|
|
|
|
LABEL description="Wakunode: Waku and Whisper client"
|
2022-02-21 15:42:27 +00:00
|
|
|
LABEL commit="unknown"
|
2020-05-26 12:04:40 +00:00
|
|
|
|
2020-09-21 19:27:22 +00:00
|
|
|
# DevP2P, LibP2P, and JSON RPC ports
|
|
|
|
EXPOSE 30303 60000 8545
|
2020-05-26 12:04:40 +00:00
|
|
|
|
|
|
|
# Referenced in the binary
|
|
|
|
RUN apk add --no-cache libgcc pcre-dev
|
|
|
|
|
|
|
|
# Fix for 'Error loading shared library libpcre.so.3: No such file or directory'
|
|
|
|
RUN ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3
|
|
|
|
|
2020-09-21 19:27:22 +00:00
|
|
|
# Copy to separate location to accomodate different MAKE_TARGET values
|
|
|
|
COPY --from=nim-build /app/build/$MAKE_TARGET /usr/local/bin/
|
|
|
|
|
2021-12-08 09:38:43 +00:00
|
|
|
# Copy migration scripts for DB upgrades
|
|
|
|
COPY --from=nim-build /app/waku/v2/node/storage/migration/migrations_scripts/ /app/waku/v2/node/storage/migration/migrations_scripts/
|
|
|
|
|
2020-09-21 19:27:22 +00:00
|
|
|
# Symlink the correct wakunode binary
|
|
|
|
RUN ln -sv /usr/local/bin/$MAKE_TARGET /usr/bin/wakunode
|
2020-05-26 12:04:40 +00:00
|
|
|
|
2020-11-04 15:21:17 +00:00
|
|
|
ENTRYPOINT ["/usr/bin/wakunode"]
|
2020-05-26 12:04:40 +00:00
|
|
|
# By default just show help if called without arguments
|
|
|
|
CMD ["--help"]
|