forked from etherisc/gif-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.brownie-container
70 lines (62 loc) · 3.02 KB
/
Dockerfile.brownie-container
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
FROM python:3.10-bullseye
EXPOSE 7545
EXPOSE 8000
# install required dependencies
# download required solidity compiler
COPY .devcontainer/scripts/install_solidity.sh /tmp
RUN /tmp/install_solidity.sh
# upgrade pip
RUN python -m pip install --upgrade pip
# install brownie
RUN pip install eth-brownie
RUN pip install loguru
RUN pip install fastapi
RUN pip install "uvicorn[standard]"
RUN useradd -m -s /bin/bash vscode
RUN chown -R vscode:vscode /home/vscode
RUN mkdir /ganache
RUN chown -R vscode:vscode /ganache
USER vscode
SHELL ["/bin/bash", "-c"]
# install nvm, node and ganache
RUN curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
RUN echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc
RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ~/.bashrc
RUN echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> ~/.bashrc
RUN . ~/.bashrc && nvm install --lts
RUN . ~/.bashrc && npm install -g ganache
# install gif dependencies
ARG VERSION_OPEN_ZEPPELIN=4.7.3
RUN wget -O /tmp/v${VERSION_OPEN_ZEPPELIN}.tar.gz https://github.com/OpenZeppelin/openzeppelin-contracts/archive/refs/tags/v${VERSION_OPEN_ZEPPELIN}.tar.gz \
&& mkdir -p /home/vscode/.brownie/packages/OpenZeppelin \
&& cd /home/vscode/.brownie/packages/OpenZeppelin \
&& tar xvfz /tmp/v${VERSION_OPEN_ZEPPELIN}.tar.gz \
&& mv openzeppelin-contracts-${VERSION_OPEN_ZEPPELIN} openzeppelin-contracts@${VERSION_OPEN_ZEPPELIN}
ARG VERSION_OPEN_ZEPPELIN=4.8.2
RUN wget -O /tmp/v${VERSION_OPEN_ZEPPELIN}.tar.gz https://github.com/OpenZeppelin/openzeppelin-contracts/archive/refs/tags/v${VERSION_OPEN_ZEPPELIN}.tar.gz \
&& mkdir -p /home/vscode/.brownie/packages/OpenZeppelin \
&& cd /home/vscode/.brownie/packages/OpenZeppelin \
&& tar xvfz /tmp/v${VERSION_OPEN_ZEPPELIN}.tar.gz \
&& mv openzeppelin-contracts-${VERSION_OPEN_ZEPPELIN} openzeppelin-contracts@${VERSION_OPEN_ZEPPELIN}
ARG VERSION_CHAINLINK=1.6.0
RUN wget -O /tmp/v${VERSION_CHAINLINK}.tar.gz https://github.com/smartcontractkit/chainlink/archive/refs/tags/v${VERSION_CHAINLINK}.tar.gz \
&& mkdir -p /home/vscode/.brownie/packages/smartcontractkit \
&& cd /home/vscode/.brownie/packages/smartcontractkit \
&& tar xvfz /tmp/v${VERSION_CHAINLINK}.tar.gz \
&& mv chainlink-${VERSION_CHAINLINK} chainlink@${VERSION_CHAINLINK}
ARG VERSION_CHAINLINK=1.10.0
RUN wget -O /tmp/v${VERSION_CHAINLINK}.tar.gz https://github.com/smartcontractkit/chainlink/archive/refs/tags/v${VERSION_CHAINLINK}.tar.gz \
&& mkdir -p /home/vscode/.brownie/packages/smartcontractkit \
&& cd /home/vscode/.brownie/packages/smartcontractkit \
&& tar xvfz /tmp/v${VERSION_CHAINLINK}.tar.gz \
&& mv chainlink-${VERSION_CHAINLINK} chainlink@${VERSION_CHAINLINK}
VOLUME /sandbox
WORKDIR /sandbox
#ENTRYPOINT ["sleep", "infinity"]
ENTRYPOINT . ~/.bashrc && ganache-cli \
--mnemonic "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat" \
--chain.chainId 1337 \
--port 7545 \
--accounts 20 \
--database.dbPath /ganache \
-h "0.0.0.0"