Created
July 5, 2018 03:13
-
-
Save guoxingx/a8ab4068db5789865b82dbbc222b76f8 to your computer and use it in GitHub Desktop.
docker solc cmd
This file contains 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
#!/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