revise for environment bootstrapping and more flexible env/tooling
This commit is contained in:
parent
85e482fe39
commit
320d70ddeb
107
Dockerfile
107
Dockerfile
|
@ -2,20 +2,28 @@ FROM node:8.11.3-stretch
|
||||||
|
|
||||||
MAINTAINER Andre Medeiros <andre@status.im>
|
MAINTAINER Andre Medeiros <andre@status.im>
|
||||||
|
|
||||||
ENV EMBARK_VERSION=3.1.5 \
|
# Embark: 8000 8545 8546
|
||||||
GANACHE_VERSION=6.1.4 \
|
# Go Ethereum: 30301/udp 30303 8545 8546 (when proxied: 8555 8556)
|
||||||
GETH_VERSION=1.8.11-dea1ce05 \
|
|
||||||
IPFS_VERSION=0.4.15
|
|
||||||
|
|
||||||
# IPFS: 5001 8080
|
# IPFS: 5001 8080
|
||||||
# Go Ethereum: 30303/tcp 30301/udp 8545
|
|
||||||
# Embark: 8000 8546 8545
|
|
||||||
# Swarm: 8500
|
# Swarm: 8500
|
||||||
EXPOSE 5001 8080 30303/tcp 30301/udp 8545 8546 8000 8500
|
EXPOSE 5001 8000 8080 8500 8545 8546 8555 8556 30301/udp 30303
|
||||||
|
|
||||||
RUN adduser --disabled-password --shell /bin/bash --gecos "" embark \
|
ARG SUEXEC_VERSION
|
||||||
|
ENV SUEXEC_VERSION=${SUEXEC_VERSION:-v0.2}
|
||||||
|
# Install su-exec
|
||||||
|
RUN cd /tmp \
|
||||||
|
&& git clone --branch ${SUEXEC_VERSION} --depth 1 \
|
||||||
|
https://github.com/ncopa/su-exec.git 2> /dev/null \
|
||||||
|
&& cd su-exec \
|
||||||
|
&& make \
|
||||||
|
&& cp su-exec /usr/local/bin/ \
|
||||||
|
&& cd .. \
|
||||||
|
&& rm -rf su-exec
|
||||||
|
|
||||||
|
ARG GETH_VERSION
|
||||||
|
ENV GETH_VERSION=${GETH_VERSION:-1.8.11-dea1ce05}
|
||||||
# Install geth
|
# Install geth
|
||||||
&& curl -fsSLO --compressed "https://gethstore.blob.core.windows.net/builds/geth-alltools-linux-amd64-${GETH_VERSION}.tar.gz" \
|
RUN curl -fsSLO --compressed "https://gethstore.blob.core.windows.net/builds/geth-alltools-linux-amd64-${GETH_VERSION}.tar.gz" \
|
||||||
&& tar -xvzf "geth-alltools-linux-amd64-${GETH_VERSION}.tar.gz" \
|
&& tar -xvzf "geth-alltools-linux-amd64-${GETH_VERSION}.tar.gz" \
|
||||||
&& for geth_tool in \
|
&& for geth_tool in \
|
||||||
abigen \
|
abigen \
|
||||||
|
@ -29,37 +37,66 @@ RUN adduser --disabled-password --shell /bin/bash --gecos "" embark \
|
||||||
; do \
|
; do \
|
||||||
cp "geth-alltools-linux-amd64-${GETH_VERSION}/${geth_tool}" "/usr/local/bin/${geth_tool}"; \
|
cp "geth-alltools-linux-amd64-${GETH_VERSION}/${geth_tool}" "/usr/local/bin/${geth_tool}"; \
|
||||||
done \
|
done \
|
||||||
&& rm -rf "geth-alltools-linux-amd64-${GETH_VERSION}*"\
|
&& rm -rf "geth-alltools-linux-amd64-${GETH_VERSION}*"
|
||||||
|
|
||||||
|
ARG IPFS_VERSION
|
||||||
|
ENV IPFS_VERSION=${IPFS_VERSION:-0.4.15}
|
||||||
# Install ipfs
|
# Install ipfs
|
||||||
&& curl -fsSLO --compressed "https://dist.ipfs.io/go-ipfs/v${IPFS_VERSION}/go-ipfs_v${IPFS_VERSION}_linux-amd64.tar.gz" \
|
RUN curl -fsSLO --compressed "https://dist.ipfs.io/go-ipfs/v${IPFS_VERSION}/go-ipfs_v${IPFS_VERSION}_linux-amd64.tar.gz" \
|
||||||
&& tar -xvzf "go-ipfs_v${IPFS_VERSION}_linux-amd64.tar.gz" \
|
&& tar -xvzf "go-ipfs_v${IPFS_VERSION}_linux-amd64.tar.gz" \
|
||||||
&& cp go-ipfs/ipfs /usr/local/bin/ipfs \
|
&& cp go-ipfs/ipfs /usr/local/bin/ipfs \
|
||||||
&& rm -rf go-ipfs "go-ipfs_v${IPFS_VERSION}_linux-amd64.tar.gz" \
|
&& rm -rf go-ipfs "go-ipfs_v${IPFS_VERSION}_linux-amd64.tar.gz"
|
||||||
&& mkdir /dapp \
|
|
||||||
&& chown embark:embark /dapp
|
|
||||||
|
|
||||||
|
# Install pip
|
||||||
|
RUN curl -fsSLO --compressed "https://bootstrap.pypa.io/get-pip.py" \
|
||||||
|
&& python get-pip.py \
|
||||||
|
&& rm get-pip.py
|
||||||
|
|
||||||
|
# Setup unprivileged user
|
||||||
|
RUN adduser --disabled-password --shell /bin/bash --gecos "" embark \
|
||||||
|
&& mkdir -p /dapp \
|
||||||
|
&& mkdir -p /home/embark/.npm-packages \
|
||||||
|
&& chown embark:embark /dapp /home/embark/.npm-packages
|
||||||
|
COPY dot.bash_env /home/embark/.bash_env
|
||||||
|
COPY dot.bash_env_nvm_load /home/embark/.bash_env_nvm_load
|
||||||
|
COPY dot.bash_env_nvm_unload /home/embark/.bash_env_nvm_unload
|
||||||
|
COPY dot.bashrc /home/embark/.bashrc
|
||||||
|
COPY dot.npmrc /home/embark/.npmrc
|
||||||
|
RUN chown embark:embark /home/embark/.bash_env \
|
||||||
|
&& chown embark:embark /home/embark/.bashrc \
|
||||||
|
&& chown embark:embark /home/embark/.npmrc
|
||||||
|
|
||||||
|
ARG EMBARK_VERSION
|
||||||
|
ARG GANACHE_VERSION
|
||||||
|
ARG NODEENV_VERSION
|
||||||
|
ARG NVM_VERSION
|
||||||
|
ENV EMBARK_VERSION=${EMBARK_VERSION:-3.1.5}
|
||||||
|
ENV GANACHE_VERSION=${GANACHE_VERSION:-6.1.4}
|
||||||
|
ENV NODEENV_VERSION=${NODEENV_VERSION:-1.3.2}
|
||||||
|
ENV NVM_VERSION=${NVM_VERSION:-v0.33.11}
|
||||||
|
# Install tooling and Embark Framework
|
||||||
USER embark
|
USER embark
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
RUN mkdir /home/embark/.npm-packages \
|
WORKDIR /home/embark
|
||||||
&& echo prefix=/home/embark/.npm-packages > /home/embark/.npmrc \
|
RUN . ${HOME}/.bash_env \
|
||||||
&& for directive in \
|
&& git clone --branch ${NVM_VERSION} --depth 1 \
|
||||||
"export NPM_PACKAGES=\$HOME/.npm-packages" \
|
https://github.com/creationix/nvm.git .nvm 2> /dev/null \
|
||||||
"export NODE_PATH=\$NPM_PACKAGES/lib/node_modules:\$NODE_PATH" \
|
&& pip install --user nodeenv==${NODEENV_VERSION} \
|
||||||
"export PATH=\$NPM_PACKAGES/bin:\$PATH" \
|
&& mkdir -p ${HOME}/.local/nodeenv \
|
||||||
; do \
|
&& npm install -g "ganache-cli@${GANACHE_VERSION}" \
|
||||||
echo ${directive} >> /home/embark/.profile \
|
&& npm install -g "embark@${EMBARK_VERSION}" \
|
||||||
&& echo ${directive} >> /home/embark/.bashrc; \
|
|
||||||
done \
|
|
||||||
# Ensure we source the updated bashrc
|
|
||||||
&& . ~/.bashrc \
|
|
||||||
# Install embark and the simulator
|
|
||||||
&& npm install -g "embark@${EMBARK_VERSION}" "ganache-cli@${GANACHE_VERSION}" \
|
|
||||||
# Initialize IPFS
|
# Initialize IPFS
|
||||||
&& ipfs init \
|
&& ipfs init \
|
||||||
# Cleanup build stuff
|
&& ipfs config --json Addresses.API '"/ip4/0.0.0.0/tcp/5001"' \
|
||||||
&& echo "Done"
|
&& ipfs config --json Addresses.Gateway '"/ip4/0.0.0.0/tcp/8080"' \
|
||||||
|
&& ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]' \
|
||||||
|
&& ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["GET", "POST", "PUT"]'
|
||||||
|
|
||||||
|
# Setup entrypoint and default working directory
|
||||||
|
USER root
|
||||||
|
SHELL ["/bin/sh", "-c"]
|
||||||
|
COPY docker-entrypoint.sh /usr/local/bin/
|
||||||
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||||
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||||
|
CMD ["bash"]
|
||||||
WORKDIR /dapp
|
WORKDIR /dapp
|
||||||
|
|
||||||
CMD ["embark"]
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue