mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-21 17:18:22 +00:00
Support for building docker images with local modifications for the purpose of testing and debugging
This commit is contained in:
parent
132d860ff3
commit
bf17bc821f
@ -10,6 +10,13 @@ Stop and delete image and volume data:
|
|||||||
`docker-compose down --rmi all -v`
|
`docker-compose down --rmi all -v`
|
||||||
`rm -R hostdatadir`
|
`rm -R hostdatadir`
|
||||||
|
|
||||||
|
# Building local modifications for testing
|
||||||
|
Sometimes, you just need to make a small change and build a new docker image for the purpose of testing. To speed up this process, the docker build has been cut into two steps.
|
||||||
|
Step 1: (buildsetup.bat) builds the setup.Dockerfile and takes care of the slow process of building the nim buildsystem. This does not need to be re-done for most small changes to the nim-codex codebase.
|
||||||
|
Step 2: (buildlocal.bat) builds the local.Dockerfile and pushes the new image as `thatbenbierens/codexlocal:latest`.
|
||||||
|
|
||||||
|
- The CI build cannot use this two-step speed-up because it builds images for multiple architectures, which the local scripts don't do.
|
||||||
|
|
||||||
# Environment variables
|
# Environment variables
|
||||||
Codex docker image supports the following environment variables:
|
Codex docker image supports the following environment variables:
|
||||||
- LISTEN_ADDRS(*)
|
- LISTEN_ADDRS(*)
|
||||||
|
2
docker/buildlocal.bat
Normal file
2
docker/buildlocal.bat
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
docker build -t thatbenbierens/codexlocal:latest -f codex.Dockerfile ..
|
||||||
|
docker push thatbenbierens/codexlocal:latest
|
2
docker/buildsetup.bat
Normal file
2
docker/buildsetup.bat
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
docker build -t thatbenbierens/codexsetup:latest -f setup.Dockerfile ..
|
||||||
|
docker push thatbenbierens/codexsetup:latest
|
12
docker/local.Dockerfile
Normal file
12
docker/local.Dockerfile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
FROM thatbenbierens/codexsetup:latest AS builder
|
||||||
|
WORKDIR /src
|
||||||
|
COPY ./codex ./codex
|
||||||
|
COPY ./docker ./docker
|
||||||
|
RUN make NIM_PARAMS="-d:disableMarchNative"
|
||||||
|
|
||||||
|
FROM alpine:3.17.2
|
||||||
|
WORKDIR /root/
|
||||||
|
RUN apk add --no-cache openssl libstdc++ libgcc libgomp
|
||||||
|
COPY --from=builder /src/build/codex ./
|
||||||
|
COPY --from=builder /src/docker/startCodex.sh ./
|
||||||
|
CMD ["sh", "startCodex.sh"]
|
6
docker/setup.Dockerfile
Normal file
6
docker/setup.Dockerfile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FROM nimlang/nim:1.6.10-alpine AS builder
|
||||||
|
WORKDIR /src
|
||||||
|
RUN apk update && apk add git cmake curl make git bash linux-headers
|
||||||
|
COPY . .
|
||||||
|
RUN make clean
|
||||||
|
RUN make update
|
@ -2,6 +2,10 @@ echo "Starting Codex..."
|
|||||||
|
|
||||||
args=""
|
args=""
|
||||||
|
|
||||||
|
## local ip as NAT?
|
||||||
|
do_nat=$(ifconfig eth0 | awk '/inet addr/ {gsub("addr:", "", $2); print $2}')
|
||||||
|
echo "got nat:$do_nat"
|
||||||
|
|
||||||
# Required arguments
|
# Required arguments
|
||||||
if [ -n "$LISTEN_ADDRS" ]; then
|
if [ -n "$LISTEN_ADDRS" ]; then
|
||||||
echo "Listen address: $LISTEN_ADDRS"
|
echo "Listen address: $LISTEN_ADDRS"
|
||||||
@ -40,10 +44,10 @@ if [ -n "$METRICS_ADDR" ] && [ -n "$METRICS_PORT" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# NAT
|
# NAT
|
||||||
if [ -n "$NAT_IP" ]; then
|
# if [ -n "$NAT_IP" ]; then
|
||||||
echo "NAT: $NAT_IP"
|
echo "NAT: $do_nat"
|
||||||
args="$args --nat=$NAT_IP"
|
args="$args --nat=$do_nat"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# Discovery IP
|
# Discovery IP
|
||||||
if [ -n "$DISC_IP" ]; then
|
if [ -n "$DISC_IP" ]; then
|
||||||
@ -108,7 +112,7 @@ fi
|
|||||||
# Ethereum persistence
|
# Ethereum persistence
|
||||||
if [ -n "$ETH_PROVIDER" ] && [ -n "$ETH_ACCOUNT" ] && [ -n "$ETH_MARKETPLACE_ADDRESS" ]; then
|
if [ -n "$ETH_PROVIDER" ] && [ -n "$ETH_ACCOUNT" ] && [ -n "$ETH_MARKETPLACE_ADDRESS" ]; then
|
||||||
echo "Persistence enabled"
|
echo "Persistence enabled"
|
||||||
args="$args --persistence=true"
|
args="$args --persistence"
|
||||||
args="$args --eth-provider=$ETH_PROVIDER"
|
args="$args --eth-provider=$ETH_PROVIDER"
|
||||||
args="$args --eth-account=$ETH_ACCOUNT"
|
args="$args --eth-account=$ETH_ACCOUNT"
|
||||||
# args="$args --validator"
|
# args="$args --validator"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user