aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Parpart <christian@ethereum.org>2018-06-22 15:27:08 +0800
committerChristian Parpart <christian@ethereum.org>2018-06-26 18:13:03 +0800
commit37b5669ec3949b3f8a407a44bbdd27eb65e0fdfe (patch)
tree55c113218cd8241281a541c43a39d28b7a2fe494
parent754610077680e19a80655ab1dcc0f430a340c232 (diff)
downloaddexon-solidity-37b5669ec3949b3f8a407a44bbdd27eb65e0fdfe.tar
dexon-solidity-37b5669ec3949b3f8a407a44bbdd27eb65e0fdfe.tar.gz
dexon-solidity-37b5669ec3949b3f8a407a44bbdd27eb65e0fdfe.tar.bz2
dexon-solidity-37b5669ec3949b3f8a407a44bbdd27eb65e0fdfe.tar.lz
dexon-solidity-37b5669ec3949b3f8a407a44bbdd27eb65e0fdfe.tar.xz
dexon-solidity-37b5669ec3949b3f8a407a44bbdd27eb65e0fdfe.tar.zst
dexon-solidity-37b5669ec3949b3f8a407a44bbdd27eb65e0fdfe.zip
make build concurrency build-time customizable
-rw-r--r--scripts/Dockerfile20
1 files changed, 18 insertions, 2 deletions
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index dd373d2a..2b2de1e2 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -12,11 +12,27 @@ RUN ./scripts/install_deps.sh
#Copy working directory on travis to the image
COPY / $WORKDIR
+# Number of parallel jobs during build
+# or 0 for auto-computing (max(1, CPU_core_count * 2/3), a greedy value)
+ARG BUILD_CONCURRENCY="0"
+
#Install dependencies, eliminate annoying warnings
RUN sed -i -E -e 's/include <sys\/poll.h>/include <poll.h>/' /usr/include/boost/asio/detail/socket_types.hpp
RUN cmake -DCMAKE_BUILD_TYPE=Release -DTESTS=0 -DSOLC_LINK_STATIC=1
-RUN make solc -j$(grep -c ^processor /proc/cpuinfo) && install -s solc/solc /usr/bin
-#RUN strip solc/solc
+RUN make solc \
+ -j$(awk "BEGIN { \
+ if (${BUILD_CONCURRENCY} != 0) { \
+ print(${BUILD_CONCURRENCY}); \
+ } else { \
+ x=($(grep -c ^processor /proc/cpuinfo) * 2/3); \
+ if (x > 1) { \
+ printf(\"%d\n\", x); \
+ } else { \
+ print(1); \
+ } \
+ } \
+ }")
+RUN strip solc/solc
FROM scratch
COPY --from=build /solidity/solc/solc /usr/bin/solc