mirror of https://github.com/waku-org/nwaku.git
chore(docker): use NIMFLAGS instead of NIM_PARAMS (#961)
NIM_PARAMS is and internal variable. NIMFLAGS should be used outside of nimbus build system. includes: * fix(docker): copy RLN parameters.key into the container * chore(makefile): NIMFLAGS in docker img rule
This commit is contained in:
parent
51cbc39d49
commit
42f48a6892
|
@ -2,7 +2,7 @@
|
|||
|
||||
FROM alpine:3.15 AS nim-build
|
||||
|
||||
ARG NIM_PARAMS
|
||||
ARG NIMFLAGS
|
||||
ARG MAKE_TARGET=wakunode2
|
||||
ARG RLN=true
|
||||
|
||||
|
@ -16,11 +16,10 @@ COPY . .
|
|||
RUN git submodule update --init --recursive
|
||||
|
||||
# Slowest build step for the sake of caching layers
|
||||
RUN make -j$(nproc) deps
|
||||
RUN make -j$(nproc) deps RLN="$RLN"
|
||||
|
||||
# Build the final node binary
|
||||
RUN make -j$(nproc) $MAKE_TARGET NIM_PARAMS="$NIM_PARAMS" RLN="$RLN"
|
||||
|
||||
RUN make -j$(nproc) $MAKE_TARGET NIMFLAGS="$NIMFLAGS" RLN="$RLN"
|
||||
# ACTUAL IMAGE -------------------------------------------------------
|
||||
|
||||
FROM alpine:3.15
|
||||
|
@ -46,6 +45,7 @@ COPY --from=nim-build /app/build/$MAKE_TARGET /usr/local/bin/
|
|||
|
||||
# If rln enabled: fix for 'Error loading shared library vendor/rln/target/debug/librln.so: No such file or directory'
|
||||
COPY --from=nim-build /app/vendor/rln/target/debug/librln.so vendor/rln/target/debug/librln.so
|
||||
COPY --from=nim-build /app/waku/v2/protocol/waku_rln_relay/parameters.key waku/v2/protocol/waku_rln_relay/parameters.key
|
||||
|
||||
# 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/
|
||||
|
|
4
Makefile
4
Makefile
|
@ -12,7 +12,7 @@ BUILD_SYSTEM_DIR := vendor/nimbus-build-system
|
|||
|
||||
# -d:insecure - Necessary to enable Prometheus HTTP endpoint for metrics
|
||||
# -d:chronicles_colors:none - Necessary to disable colors in logs for Docker
|
||||
DOCKER_IMAGE_NIM_PARAMS ?= -d:chronicles_colors:none -d:insecure
|
||||
DOCKER_IMAGE_NIMFLAGS ?= -d:chronicles_colors:none -d:insecure
|
||||
|
||||
EXCLUDED_NIM_PACKAGES := vendor/nim-dnsdisc/vendor
|
||||
|
||||
|
@ -215,7 +215,7 @@ docker-image: DOCKER_IMAGE_NAME ?= statusteam/nim-waku:$(DOCKER_IMAGE_TAG)
|
|||
docker-image:
|
||||
docker build \
|
||||
--build-arg="MAKE_TARGET=$(MAKE_TARGET)" \
|
||||
--build-arg="NIM_PARAMS=$(DOCKER_IMAGE_NIM_PARAMS)" \
|
||||
--build-arg="NIMFLAGS=$(DOCKER_IMAGE_NIMFLAGS)" \
|
||||
--tag $(DOCKER_IMAGE_NAME) .
|
||||
|
||||
docker-push:
|
||||
|
|
|
@ -5,9 +5,9 @@ pipeline {
|
|||
|
||||
parameters {
|
||||
string(
|
||||
name: 'NIM_PARAMS',
|
||||
name: 'NIMFLAGS',
|
||||
description: 'Flags for Nim compilation.',
|
||||
defaultValue: params.NIM_PARAMS ?: '-d:disableMarchNative -d:insecure --parallelBuild:6'
|
||||
defaultValue: params.NIMFLAGS ?: '-d:disableMarchNative -d:insecure --parallelBuild:6'
|
||||
)
|
||||
string(
|
||||
name: 'LOG_LEVEL',
|
||||
|
|
|
@ -29,9 +29,9 @@ pipeline {
|
|||
defaultValue: params.IMAGE_NAME ?: 'statusteam/nim-waku',
|
||||
)
|
||||
string(
|
||||
name: 'NIM_PARAMS',
|
||||
name: 'NIMFLAGS',
|
||||
description: 'Flags for Nim compilation.',
|
||||
defaultValue: params.NIM_PARAMS ?: '-d:disableMarchNative -d:chronicles_colors:none -d:insecure',
|
||||
defaultValue: params.NIMFLAGS ?: '-d:disableMarchNative -d:chronicles_colors:none -d:insecure',
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ pipeline {
|
|||
"${params.IMAGE_NAME}:${env.GIT_COMMIT.take(8)}",
|
||||
"--label=commit='${env.GIT_COMMIT.take(8)}' " +
|
||||
"--build-arg=MAKE_TARGET='${params.MAKE_TARGET}' " +
|
||||
"--build-arg=NIM_PARAMS='${params.NIM_PARAMS}' ."
|
||||
"--build-arg=NIMFLAGS='${params.NIMFLAGS}' ."
|
||||
)
|
||||
} }
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ Key part is the definition of four `parameters`:
|
|||
* `MAKE_TARGET` - Which `Makefile` target is built.
|
||||
* `IMAGE_TAG` - Tag of the Docker image to push.
|
||||
* `IMAGE_NAME` - Name of the Docker image to push.
|
||||
* `NIM_PARAMS` - Nim compilation parameters.
|
||||
* `NIMFLAGS` - Nim compilation parameters.
|
||||
|
||||
The use of `?:` [Elvis operator](http://groovy-lang.org/operators.html#_elvis_operator) plays a key role in allowing parameters to be changed for each defined job in Jenkins without it being overridden by the `Jenkinsfile` defaults after every job run.
|
||||
```groovy
|
||||
|
|
Loading…
Reference in New Issue