From 5667618e7bbab30ab82cb479c17ce3661fe873a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Sat, 18 Apr 2015 18:33:22 +0300 Subject: [PATCH 1/4] Dockerfile: reduce layers from 22 to 14 --- Dockerfile | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index fcd564a34a..c5d97fb840 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,39 +1,36 @@ FROM ubuntu:14.04.2 ## Environment setup -ENV HOME /root ENV GOPATH /root/go ENV PATH /root/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games -RUN mkdir -p /root/go ENV DEBIAN_FRONTEND noninteractive ## Install base dependencies -RUN apt-get update && apt-get upgrade -y -RUN apt-get install -y git mercurial build-essential software-properties-common wget pkg-config libgmp3-dev libreadline6-dev libpcre3-dev libpcre++-dev +RUN apt-get update && apt-get upgrade -y && \ + apt-get install -y git mercurial build-essential software-properties-common wget \ + pkg-config libgmp3-dev libreadline6-dev libpcre3-dev libpcre++-dev ## Install Qt5.4.1 (not required for CLI) -# RUN add-apt-repository ppa:beineri/opt-qt541-trusty -y -# RUN apt-get update -y -# RUN apt-get install -y qt54quickcontrols qt54webengine mesa-common-dev libglu1-mesa-dev +# RUN add-apt-repository ppa:beineri/opt-qt541-trusty -y && \ +# apt-get install -y qt54quickcontrols qt54webengine mesa-common-dev libglu1-mesa-dev # ENV PKG_CONFIG_PATH /opt/qt54/lib/pkgconfig -# Install Golang -RUN wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz -RUN tar -C /usr/local -xzf go*.tar.gz && go version +# Install Go +RUN wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz && \ + tar -C /usr/local -xzf go*.tar.gz && \ + go version -# this is a workaround, to make sure that docker's cache is invalidated whenever the git repo changes +# Workaround, to make sure that docker's cache is invalidated whenever the git repo changes ADD https://api.github.com/repos/ethereum/go-ethereum/git/refs/heads/develop file_does_not_exist ## Fetch and install go-ethereum -RUN mkdir -p $GOPATH/src/github.com/ethereum/ -RUN git clone https://github.com/ethereum/go-ethereum $GOPATH/src/github.com/ethereum/go-ethereum -WORKDIR $GOPATH/src/github.com/ethereum/go-ethereum -RUN git checkout develop -RUN GOPATH=$GOPATH:$GOPATH/src/github.com/ethereum/go-ethereum/Godeps/_workspace go install -v ./cmd/geth +RUN mkdir -p $GOPATH/src/github.com/ethereum/ && \ + git clone https://github.com/ethereum/go-ethereum $GOPATH/src/github.com/ethereum/go-ethereum && \ + cd $GOPATH/src/github.com/ethereum/go-ethereum && \ + git checkout develop && \ + GOPATH=$GOPATH:$GOPATH/src/github.com/ethereum/go-ethereum/Godeps/_workspace go install -v ./cmd/geth ## Run & expose JSON RPC ENTRYPOINT ["geth", "-rpc=true", "-rpcport=8545"] EXPOSE 8545 - - From 8286e4c6e4b616d2eb47ac96b15f4f5ecb608105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Sat, 18 Apr 2015 19:14:35 +0300 Subject: [PATCH 2/4] Dockerfile: don't install unneeded packages, dump Go RACE --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c5d97fb840..2d7a59fd1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,16 +9,17 @@ ENV DEBIAN_FRONTEND noninteractive ## Install base dependencies RUN apt-get update && apt-get upgrade -y && \ apt-get install -y git mercurial build-essential software-properties-common wget \ - pkg-config libgmp3-dev libreadline6-dev libpcre3-dev libpcre++-dev + pkg-config libgmp3-dev libreadline6-dev libpcre3-dev libpcre++-dev --no-install-recommends ## Install Qt5.4.1 (not required for CLI) # RUN add-apt-repository ppa:beineri/opt-qt541-trusty -y && \ # apt-get install -y qt54quickcontrols qt54webengine mesa-common-dev libglu1-mesa-dev # ENV PKG_CONFIG_PATH /opt/qt54/lib/pkgconfig -# Install Go +# Install Go, dump the race detector RUN wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz && \ - tar -C /usr/local -xzf go*.tar.gz && \ + tar -C /usr/local -xzf go*.tar.gz && \ + rm -rf /usr/local/go/pkg/linux_amd64_race && \ go version # Workaround, to make sure that docker's cache is invalidated whenever the git repo changes From 4812c12488b77884b2e162fb9c0a76ffb6aca79a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 20 Apr 2015 11:49:44 +0300 Subject: [PATCH 3/4] Dockerfile: remove some packages, direct download vs git --- Dockerfile | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2d7a59fd1b..b7466d396d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,28 +8,32 @@ ENV DEBIAN_FRONTEND noninteractive ## Install base dependencies RUN apt-get update && apt-get upgrade -y && \ - apt-get install -y git mercurial build-essential software-properties-common wget \ - pkg-config libgmp3-dev libreadline6-dev libpcre3-dev libpcre++-dev --no-install-recommends + apt-get install -y build-essential software-properties-common wget pkg-config \ + libgmp3-dev unzip --no-install-recommends ## Install Qt5.4.1 (not required for CLI) # RUN add-apt-repository ppa:beineri/opt-qt541-trusty -y && \ # apt-get install -y qt54quickcontrols qt54webengine mesa-common-dev libglu1-mesa-dev # ENV PKG_CONFIG_PATH /opt/qt54/lib/pkgconfig -# Install Go, dump the race detector +# Install Go, dump the tarball and race detector RUN wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz && \ tar -C /usr/local -xzf go*.tar.gz && \ - rm -rf /usr/local/go/pkg/linux_amd64_race && \ + rm -rf go*.tar.gz /usr/local/go/pkg/linux_amd64_race && \ go version # Workaround, to make sure that docker's cache is invalidated whenever the git repo changes ADD https://api.github.com/repos/ethereum/go-ethereum/git/refs/heads/develop file_does_not_exist ## Fetch and install go-ethereum -RUN mkdir -p $GOPATH/src/github.com/ethereum/ && \ - git clone https://github.com/ethereum/go-ethereum $GOPATH/src/github.com/ethereum/go-ethereum && \ - cd $GOPATH/src/github.com/ethereum/go-ethereum && \ - git checkout develop && \ +RUN mkdir -p $GOPATH/src/github.com/ethereum && \ + cd $GOPATH/src/github.com/ethereum && \ + \ + wget https://github.com/ethereum/go-ethereum/archive/develop.zip && \ + unzip *.zip && mv go-ethereum-develop go-ethereum && \ + rm -f *.zip && \ + \ + cd go-ethereum && \ GOPATH=$GOPATH:$GOPATH/src/github.com/ethereum/go-ethereum/Godeps/_workspace go install -v ./cmd/geth ## Run & expose JSON RPC From ed9985347be5e23212138343d50496a01ef393c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 20 Apr 2015 20:32:03 +0300 Subject: [PATCH 4/4] Dockerfile: further remove uneeded packages --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b7466d396d..66a384b42f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,7 @@ ENV DEBIAN_FRONTEND noninteractive ## Install base dependencies RUN apt-get update && apt-get upgrade -y && \ - apt-get install -y build-essential software-properties-common wget pkg-config \ - libgmp3-dev unzip --no-install-recommends + apt-get install -y build-essential ca-certificates pkg-config libgmp3-dev wget unzip --no-install-recommends ## Install Qt5.4.1 (not required for CLI) # RUN add-apt-repository ppa:beineri/opt-qt541-trusty -y && \ @@ -34,7 +33,8 @@ RUN mkdir -p $GOPATH/src/github.com/ethereum rm -f *.zip && \ \ cd go-ethereum && \ - GOPATH=$GOPATH:$GOPATH/src/github.com/ethereum/go-ethereum/Godeps/_workspace go install -v ./cmd/geth + GOPATH=$GOPATH:$GOPATH/src/github.com/ethereum/go-ethereum/Godeps/_workspace go install -v ./cmd/geth && \ + rm -rf $GOPATH/pkg $GOPATH/src/github.com/ethereum/go-ethereum/Godeps/_workspace/pkg ## Run & expose JSON RPC ENTRYPOINT ["geth", "-rpc=true", "-rpcport=8545"]