From ce8657c0bbbc51b757c84f9c4a39e09d33f12f76 Mon Sep 17 00:00:00 2001 From: Jorge Antonio Date: Mon, 23 Dec 2024 11:27:48 +0000 Subject: [PATCH] first commit --- docker-compose.yaml | 4 +++- entrypoint.sh | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 481b7918..609f9cce 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,7 +4,8 @@ x-atoma-node: &atoma-node volumes: - ${CONFIG_PATH:-./config.toml}:/app/config.toml - ./logs:/app/logs - - ${SUI_CONFIG_PATH:-~/.sui/sui_config}:/root/.sui/sui_config + - sui-config-volume:/root/.sui/sui_config + - ${SUI_CONFIG_PATH:-~/.sui/sui_config}:/tmp/.sui/sui_config - ./data:/app/data env_file: .env networks: @@ -191,3 +192,4 @@ networks: volumes: postgres-data: grafana_data: + sui-config-volume: diff --git a/entrypoint.sh b/entrypoint.sh index 0648f4f7..73d28c85 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,12 +1,19 @@ #!/bin/bash -# Ensure the directory exists +# 1) Ensure the container's config directory exists mkdir -p /root/.sui/sui_config -# If client.yaml exists, modify it +# 2) If the named volume is empty, copy the entire folder from the host +if [ -z "$(ls -A /root/.sui/sui_config)" ] && [ -d /tmp/.sui/sui_config ]; then + echo "Seeding /root/.sui/sui_config from /tmp/.sui/sui_config..." + cp -r /tmp/.sui/sui_config/. /root/.sui/sui_config/ +fi + +# 3) Further modify specific files in the container: if [ -f /root/.sui/sui_config/client.yaml ]; then + echo "Modifying client.yaml..." sed -i 's|File: .*|File: /root/.sui/sui_config/sui.keystore|' /root/.sui/sui_config/client.yaml fi -# Execute the main command passed to the container +# 4) Run the main command/args exec "$@"