Skip to content

Instantly share code, notes, and snippets.

@guoxingx
Created July 5, 2018 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guoxingx/a8ab4068db5789865b82dbbc222b76f8 to your computer and use it in GitHub Desktop.
Save guoxingx/a8ab4068db5789865b82dbbc222b76f8 to your computer and use it in GitHub Desktop.
docker solc cmd
#!/usr/bin/env python
"""
chmod a+x solcdocker
mv solcdocker /usr/local/bin
usage:
solcdocker <path-to-sol-file>
output:
./solc-output/<filename>.abi
./solc-output/<filename>.bin
"""
import sys
import os
filepath = sys.argv[1]
curpath = os.path.abspath('./')
filepath = os.path.abspath(filepath)
dirpath = os.path.dirname(filepath)
workdir = "/output"
outputdir = "{}/solc-output".format(workdir)
inputdir = "/solidity"
cmd = "docker run -v {}:{} -v {}:{} ethereum/solc:stable -o {} --abi --bin {}{}".format(
dirpath, inputdir, curpath, workdir, outputdir, inputdir, filepath.split(dirpath)[-1])
print(cmd)
os.system(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment