-
Notifications
You must be signed in to change notification settings - Fork 12
Add Dockerfile #5
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c5921ca
Add Dockerfile
feuGeneA f572e96
Fix example docker command
feuGeneA e3d61d6
Parameterize ETH_RPC_URL, not ALCHEMY_API_URL
feuGeneA 565d6f9
Example command to clear cache and run
feuGeneA 8243a08
Fixup comments: RPC, not Alchemy
feuGeneA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Building this image will include the running of all benchmarks in a "cold | ||
# cache" state, and thus will take quite a bit of time (roughly 30-60 minutes, | ||
# with Ganache excluded). The cache will be retained in the built image, such | ||
# that running the image will execute benchmarks with a "warm cache". For | ||
# example: | ||
# | ||
# docker build --build-arg ETH_RPC_URL=... -t sim . | ||
# docker run sim benchmark-hardhat | ||
# | ||
# To benchmark with a cleared cache, and without having to rebuild the entire | ||
# tool environment, use something like: | ||
# | ||
# docker run --entrypoint /bin/bash sim -c "rm -rf cache && make benchmark-hardhat" | ||
# | ||
# BEWARE: This image should not be published because it will contain traces of | ||
# your RPC url, which likely contains your private API key secret. (See | ||
# https://stackoverflow.com/a/40762010/406289 .) Future work can take advantage | ||
# of Docker's support for secrets, but unless/until there's a need to publish | ||
# this image, that would be overkill. | ||
|
||
FROM debian | ||
|
||
ARG ETH_RPC_URL | ||
|
||
RUN if [ -z "${ETH_RPC_URL}" ]; then \ | ||
echo build argument ETH_RPC_URL required; \ | ||
exit 1; \ | ||
fi && \ | ||
apt-get update && \ | ||
apt-get install --yes curl git make xz-utils yarnpkg && \ | ||
ln -s /usr/bin/yarnpkg /usr/bin/yarn | ||
|
||
# nix/dapptools don't like to install/run as root | ||
RUN useradd user && \ | ||
mkdir -p -m 0755 /home/user && \ | ||
chown user /home/user && \ | ||
mkdir -m 0755 /nix && \ | ||
chown user /nix | ||
WORKDIR /home/user | ||
USER user | ||
# nix/dapptools install scripts require this environment: | ||
ENV USER=user | ||
ENV BASH_ENV=/home/user/.profile | ||
ENV SHELL=/bin/bash | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
RUN git clone https://github.com/mds1/convex-shutdown-simulation.git | ||
WORKDIR convex-shutdown-simulation | ||
|
||
RUN yarn && \ | ||
cp .env.example .env && \ | ||
sed -i "s!ETH_RPC_URL=.*!ETH_RPC_URL=${ETH_RPC_URL}!" .env && \ | ||
curl -L https://raw.githubusercontent.com/gakonst/foundry/master/foundryup/install | bash | ||
# Don't combine these sequential RUN commands because we need fresh shell | ||
# instances in order for each install script to take effect. | ||
RUN foundryup && \ | ||
curl -L https://nixos.org/nix/install | bash | ||
RUN curl -L https://dapp.tools/install | bash | ||
RUN dapp update | ||
|
||
# TODO: Benchmark ganache too, once it's fixed. | ||
# (See https://github.com/mds1/convex-shutdown-simulation/pull/4) | ||
RUN make benchmark-foundry && \ | ||
make benchmark-hardhat && \ | ||
make benchmark-dapptools | ||
|
||
ENTRYPOINT ["make"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.