mirror of
https://github.com/waku-org/nwaku.git
synced 2025-02-23 12:28:55 +00:00
add a Dockerfile for creating nim-waku images
Also I remove old Dockerfile at waku/node/v1/docker. Images are uploaded to our Docker Hub account: https://hub.docker.com/r/statusteam/nim-waku Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
e0a5f810b7
commit
8a648a44aa
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/README.md
|
||||||
|
/Dockerfile
|
||||||
|
/.*ignore
|
||||||
|
/LICENSE*
|
||||||
|
/tests
|
||||||
|
/metrics
|
||||||
|
**/vendor/*
|
38
Dockerfile
Normal file
38
Dockerfile
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# BUILD IMAGE --------------------------------------------------------
|
||||||
|
FROM alpine:3.11 AS nim-build
|
||||||
|
|
||||||
|
ARG NIM_PARAMS
|
||||||
|
|
||||||
|
# Get build tools and required header files
|
||||||
|
RUN apk add --no-cache bash build-base pcre-dev linux-headers git
|
||||||
|
|
||||||
|
RUN mkdir /app
|
||||||
|
WORKDIR /app
|
||||||
|
ADD . .
|
||||||
|
|
||||||
|
# Ran separately from 'make' to avoid re-doing
|
||||||
|
RUN git submodule update --init --recursive
|
||||||
|
|
||||||
|
# Build the node binary
|
||||||
|
RUN make -j$(nproc) wakunode NIM_PARAMS="${NIM_PARAMS}"
|
||||||
|
|
||||||
|
# ACTUAL IMAGE -------------------------------------------------------
|
||||||
|
FROM alpine:3.11
|
||||||
|
|
||||||
|
LABEL maintainer="jakub@status.im"
|
||||||
|
LABEL source="https://github.com/status-im/nim-waku"
|
||||||
|
LABEL description="Wakunode: Waku and Whisper client"
|
||||||
|
|
||||||
|
EXPOSE 1234
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
COPY --from=nim-build /app/build/wakunode /usr/bin/wakunode
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/bin/wakunode"]
|
||||||
|
# By default just show help if called without arguments
|
||||||
|
CMD ["--help"]
|
15
Makefile
15
Makefile
@ -10,6 +10,12 @@ SHELL := bash # the shell used internally by Make
|
|||||||
# used inside the included makefiles
|
# used inside the included makefiles
|
||||||
BUILD_SYSTEM_DIR := vendor/nimbus-build-system
|
BUILD_SYSTEM_DIR := vendor/nimbus-build-system
|
||||||
|
|
||||||
|
# Docker image name
|
||||||
|
DOCKER_IMAGE_TAG ?= latest
|
||||||
|
DOCKER_IMAGE_NAME ?= statusteam/nim-waku:$(DOCKER_IMAGE_TAG)
|
||||||
|
# Necessary to enable Prometheus HTTP endpoint for metrics
|
||||||
|
DOCKER_IMAGE_NIM_PARAMS ?= -d:insecure
|
||||||
|
|
||||||
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
|
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
|
||||||
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
|
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
|
||||||
|
|
||||||
@ -93,6 +99,15 @@ waku.nims:
|
|||||||
libbacktrace:
|
libbacktrace:
|
||||||
+ $(MAKE) -C vendor/nim-libbacktrace --no-print-directory BUILD_CXX_LIB=0
|
+ $(MAKE) -C vendor/nim-libbacktrace --no-print-directory BUILD_CXX_LIB=0
|
||||||
|
|
||||||
|
# build a docker image for the fleet
|
||||||
|
docker-image:
|
||||||
|
docker build \
|
||||||
|
--build-arg="NIM_PARAMS=$(DOCKER_IMAGE_NIM_PARAMS)" \
|
||||||
|
--tag $(DOCKER_IMAGE_NAME) .
|
||||||
|
|
||||||
|
docker-push:
|
||||||
|
docker push $(DOCKER_IMAGE_NAME)
|
||||||
|
|
||||||
# builds and runs the test suite
|
# builds and runs the test suite
|
||||||
test: | build deps
|
test: | build deps
|
||||||
$(ENV_SCRIPT) nim test $(NIM_PARAMS) waku.nims
|
$(ENV_SCRIPT) nim test $(NIM_PARAMS) waku.nims
|
||||||
|
@ -37,6 +37,12 @@ make wakunode
|
|||||||
./build/wakunode --log-level:debug --discovery:off --fleet:test --log-metrics
|
./build/wakunode --log-level:debug --discovery:off --fleet:test --log-metrics
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also create a Docker image using:
|
||||||
|
```bash
|
||||||
|
make docker-image
|
||||||
|
docker run --rm -it statusteam/nim-waku:latest --help
|
||||||
|
```
|
||||||
|
|
||||||
### Waku Protocol Test Suite
|
### Waku Protocol Test Suite
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
FROM debian:bullseye-slim AS build
|
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-c"]
|
|
||||||
|
|
||||||
RUN apt-get -qq update \
|
|
||||||
&& apt-get -qq -y install build-essential make wget libpcre3-dev git curl &>/dev/null \
|
|
||||||
&& apt-get -qq clean
|
|
||||||
|
|
||||||
ARG GIT_REVISION
|
|
||||||
|
|
||||||
RUN cd /root \
|
|
||||||
&& git clone https://github.com/status-im/nim-waku.git \
|
|
||||||
&& cd nim-waku \
|
|
||||||
&& git reset --hard ${GIT_REVISION} \
|
|
||||||
&& { make &>/dev/null || true; } \
|
|
||||||
&& make -j$(nproc) update \
|
|
||||||
&& make NIMFLAGS="-d:debug -d:insecure" wakunode
|
|
||||||
|
|
||||||
# --------------------------------- #
|
|
||||||
# Starting new image to reduce size #
|
|
||||||
# --------------------------------- #
|
|
||||||
FROM debian:bullseye-slim
|
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-c"]
|
|
||||||
|
|
||||||
RUN apt-get -qq update \
|
|
||||||
&& apt-get -qq -y install libpcre3 &>/dev/null \
|
|
||||||
&& apt-get -qq clean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
||||||
|
|
||||||
COPY --from=build /root/nim-waku/build/wakunode /usr/bin/wakunode
|
|
||||||
|
|
||||||
MAINTAINER Kim De Mey <kimdemey@status.im>
|
|
||||||
LABEL description="Wakunode: Waku and Whisper client"
|
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/wakunode"]
|
|
@ -1,16 +0,0 @@
|
|||||||
SHELL := bash # the shell used internally by "make"
|
|
||||||
|
|
||||||
# These default settings can be overriden by exporting env variables
|
|
||||||
|
|
||||||
GIT_REVISION ?= $(shell git rev-parse HEAD)
|
|
||||||
|
|
||||||
IMAGE_TAG ?= latest
|
|
||||||
IMAGE_NAME ?= statusteam/nimbus_wakunode:$(IMAGE_TAG)
|
|
||||||
|
|
||||||
build:
|
|
||||||
docker build \
|
|
||||||
--build-arg="GIT_REVISION=$(GIT_REVISION)" \
|
|
||||||
-t $(IMAGE_NAME) .
|
|
||||||
|
|
||||||
push: build
|
|
||||||
docker push $(IMAGE_NAME)
|
|
Loading…
x
Reference in New Issue
Block a user