Skip to content

Commit

Permalink
Add chia-tools to the image and run if chia. prefixed env is set (#269)
Browse files Browse the repository at this point in the history
* Add chia-tools to the image and run if chia. prefixed env is set

* Move chia tools to path
  • Loading branch information
cmmarslender authored Sep 11, 2024
1 parent 2783642 commit 4dc9688
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ RUN echo "cloning ${BRANCH}" && \

# Get yq for chia config changes
FROM mikefarah/yq:4 AS yq
# Get chia-tools for a new experimental chia config management strategy
FROM ghcr.io/chia-network/chia-tools:latest AS chia-tools

# IMAGE BUILD
FROM python:3.11-slim
Expand Down Expand Up @@ -61,6 +63,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
dpkg-reconfigure -f noninteractive tzdata

COPY --from=yq /usr/bin/yq /usr/bin/yq
COPY --from=chia-tools /chia-tools /usr/bin/chia-tools
COPY --from=chia_build /chia-blockchain /chia-blockchain

ENV PATH=/chia-blockchain/venv/bin:$PATH
Expand Down
8 changes: 8 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,12 @@ if [[ ${service} == "harvester" ]]; then
fi
fi

# EXPERIMENTAL!
# If you use any of the chia tools config processing, your config will lose all yaml anchors and be fully expanded out
# Check if any of the env vars start with "chia." or "chia__" and if so, process the config with chia-tools
if env | grep -qE '^chia(\.|__)'; then
echo "Found environment variables starting with 'chia.' or 'chia__' - Running chia-tools"
/usr/bin/chia-tools config edit "$CHIA_ROOT/config/config.yaml"
fi

exec "$@"

0 comments on commit 4dc9688

Please sign in to comment.