aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-06-26 18:26:19 +0800
committerGitHub <noreply@github.com>2018-06-26 18:26:19 +0800
commit4bb9fced1e45df87d21941c8964c113f6aa91a53 (patch)
treed8aaeefb697994db6d4b0197aa4315e74b1d5f66
parente6595d880615a4e2b9572b8026e931abe63c04a9 (diff)
parentb9f2a7804c0e89b85695a246ce2eb39bdff2db30 (diff)
downloaddexon-solidity-4bb9fced1e45df87d21941c8964c113f6aa91a53.tar.gz
dexon-solidity-4bb9fced1e45df87d21941c8964c113f6aa91a53.tar.zst
dexon-solidity-4bb9fced1e45df87d21941c8964c113f6aa91a53.zip
Merge pull request #4332 from ethereum/dockerfile-small-improvements
Dockerfile small improvements
-rw-r--r--.dockerignore6
-rw-r--r--scripts/Dockerfile39
2 files changed, 36 insertions, 9 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..ab452ecf
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,6 @@
+# out-of-tree builds usually go here. This helps improving performance of uploading
+# the build context to the docker image build server
+/build
+
+# in-tree builds
+/deps
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 654a9f29..2b2de1e2 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -1,18 +1,39 @@
-FROM alpine
+FROM alpine AS build
MAINTAINER chriseth <chris@ethereum.org>
#Official solidity docker image
#Establish working directory as solidity
WORKDIR /solidity
+
+# Build dependencies
+ADD /scripts/install_deps.sh /solidity/scripts/install_deps.sh
+RUN ./scripts/install_deps.sh
+
#Copy working directory on travis to the image
COPY / $WORKDIR
-#Install dependencies, eliminate annoying warnings, and build release, delete all remaining points and statically link.
-RUN ./scripts/install_deps.sh && sed -i -E -e 's/include <sys\/poll.h>/include <poll.h>/' /usr/include/boost/asio/detail/socket_types.hpp &&\
-cmake -DCMAKE_BUILD_TYPE=Release -DTESTS=0 -DSOLC_LINK_STATIC=1 &&\
-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/*
+# 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$(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
-ENTRYPOINT ["/usr/bin/solc"] \ No newline at end of file
+FROM scratch
+COPY --from=build /solidity/solc/solc /usr/bin/solc
+ENTRYPOINT ["/usr/bin/solc"]