How to install Solidity compiler in Docker container - solc

Viewed 1129

To all experts,

I have my Django web app running inside a Docker container, how can I have the Solidity compiler to run in my Docker container as well? Please advise.

RUN \
  apk --no-cache --update add build-base cmake boost-dev git                                                && \
  sed -i -E -e 's/include <sys\/poll.h>/include <poll.h>/' /usr/include/boost/asio/detail/socket_types.hpp  && \
  git clone --depth 1 --recursive -b release https://github.com/ethereum/solidity                           && \
  cd /solidity && cmake -DCMAKE_BUILD_TYPE=Release -DTESTS=0 -DSTATIC_LINKING=1                             && \
  cd /solidity && make solc && install -s  solc/solc /usr/bin                                               && \
  cd / && rm -rf solidity                                                                                   && \
  apk del sed build-base git make cmake gcc g++ musl-dev curl-dev boost-dev                                 && \
  rm -rf /var/cache/apk/*
1 Answers

You should use docker image to compile solidity files ,For example

docker run -v YourLocalDirectory:/sources ethereum/solc:stable -o /sources/output --abi --bin

you can find artifact in output directory of your local contract directory More information visit this site: https://docs.soliditylang.org/en/v0.5.11/installing-solidity.html

Related