Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor docker entrypoint file to not change client.yaml in place #301

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -191,3 +192,4 @@ networks:
volumes:
postgres-data:
grafana_data:
sui-config-volume:
13 changes: 10 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"