Skip to content

Commit

Permalink
Move every docker related config file to the project root
Browse files Browse the repository at this point in the history
  • Loading branch information
IAvecilla committed Jan 16, 2024
1 parent 99dc691 commit a3b270d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 37 deletions.
6 changes: 3 additions & 3 deletions node/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Build Stage
FROM rust:1.72.1 as build
COPY . /node/
COPY /node/ Makefile /node/
WORKDIR /node
RUN apt-get update && apt-get install -y libclang-dev
RUN cargo build --release
RUN cd tools && make docker_node_configs
RUN make docker_node_configs

# Runtime Stage
FROM debian:stable-slim as runtime

COPY --from=build /node/target/release/executor /node/
COPY --from=build /node/tools/docker-config/node-configs /node/
COPY --from=build /node/entrypoint.sh /node/
COPY entrypoint.sh /node/

WORKDIR /node
RUN chmod +x entrypoint.sh
Expand Down
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.PHONY: node node_configs docker_node_configs node_docker consenus_docker_example clean clean_docker
IP?=127.0.0.1:3054
DOCKER_IP=172.12.0.10
EXECUTABLE_NODE_DIR=node/tools

# Locally run commands

node:
export RUST_LOG=INFO && cd ${EXECUTABLE_NODE_DIR}/node-configs/${IP} && cargo run -- --database ../../database/${IP}

node_configs:
cd ${EXECUTABLE_NODE_DIR} && cargo run --bin localnet_config -- --input-addrs addresses.txt --output-dir node-configs

# Docker commands

docker_node_configs:
cd tools && cargo run --release --bin localnet_config -- --input-addrs docker-config/addresses.txt --output-dir docker-config/node-configs

node_docker:
mkdir -p ${EXECUTABLE_NODE_DIR}/docker-config
cd ${EXECUTABLE_NODE_DIR}/docker-config && rm -rf addresses.txt && echo ${DOCKER_IP}:3054 >> addresses.txt
docker-compose up -d node-1

consenus_docker_example:
mkdir -p ${EXECUTABLE_NODE_DIR}/docker-config
cd ${EXECUTABLE_NODE_DIR}/docker-config && rm -rf addresses.txt && touch addresses.txt && echo 172.12.0.10:3054 >> addresses.txt && echo 172.12.0.11:3054 >> addresses.txt
docker-compose up -d

# Clean commands

clean: clean_docker
rm -rf ${EXECUTABLE_NODE_DIR}/node-configs
rm -rf ${EXECUTABLE_NODE_DIR}/database

clean_docker:
rm -rf ${EXECUTABLE_NODE_DIR}/docker-config
docker rm -f consensus-node
docker rm -f consensus-node-1
docker rm -f consensus-node-2
docker network rm -f node-net
docker image rm -f consensus-node
File renamed without changes.
File renamed without changes.
34 changes: 0 additions & 34 deletions node/tools/Makefile

This file was deleted.

0 comments on commit a3b270d

Please sign in to comment.