Skip to content

Commit

Permalink
allow to run scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez committed Mar 9, 2024
1 parent 6756ee4 commit 7afe8e4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
FROM ghcr.io/fgimenez/eip3074-tools:latest

ENTRYPOINT ["/usr/local/bin/forge"]
CMD ["--help"]
ENTRYPOINT ["/entrypoint.sh"]
3 changes: 3 additions & 0 deletions Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ COPY --from=forge-builder /app/foundry/target/release/forge /usr/local/bin/forge

RUN chmod +x /usr/local/bin/solc && \
chmod +x /usr/local/bin/forge

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
17 changes: 17 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

FOUNDRY_COMMAND="$1"
SOLC_PATH="--use /usr/local/bin/solc"
FOUNDRY_DIRECTORY="--root $2"
FOUNDRY_SCRIPT="$3"

if [ "$FOUNDRY_COMMAND" = "script" ] && [ -z "$FOUNDRY_SCRIPT" ]; then
echo "Error: 'foundry-script' is required when 'foundry-command' is 'script'"
exit 1
fi

if [ "$FOUNDRY_COMMAND" = "script" ]; then
exec forge script $FOUNDRY_SCRIPT $SOLC_PATH $FOUNDRY_DIRECTORY --fork-url http://localhost:8545 --broadcast -vvvv
else
exec forge $FOUNDRY_COMMAND $SOLC_PATH $FOUNDRY_DIRECTORY
fi

0 comments on commit 7afe8e4

Please sign in to comment.