improved dockerfile builds (#5659)

* docker builds current branch instead of cloning the repo

* moved ADD command right before RUN cd parity in Dockerfiles

* update docker/README.md

* removed --no-cache from docker/README.md
This commit is contained in:
Marek Kotewicz 2017-05-23 12:25:41 +02:00 committed by Arkadiy Paronyan
parent f47cbe0be6
commit 92f5aa7e10
11 changed files with 48 additions and 190 deletions

22
.dockerignore Normal file
View File

@ -0,0 +1,22 @@
# Generated by Cargo
# will have compiled files and executables
target
*.swp
*.swo
*.swn
*.DS_Store
# Visual Studio Code stuff
.vscode
# GitEye stuff
.project
# idea ide
.idea
# git stuff
.git
ethcore/res/ethereum/tests

3
docker/README.md Normal file
View File

@ -0,0 +1,3 @@
Usage
```docker build -f docker/ubuntu/Dockerfile --tag ethcore/parity:branch_or_tag_name .```

View File

@ -1,29 +1,32 @@
FROM centos:latest FROM centos:latest
WORKDIR /build WORKDIR /build
# install tools and dependencies # install tools and dependencies
RUN yum -y update&& \ RUN yum -y update&& \
yum install -y git make gcc-c++ gcc file binutils yum install -y git make gcc-c++ gcc file binutils
# install rustup # install rustup
RUN curl -sSf https://static.rust-lang.org/rustup.sh -o rustup.sh &&\ RUN curl -sSf https://static.rust-lang.org/rustup.sh -o rustup.sh &&\
ls&&\ ls&&\
sh rustup.sh --disable-sudo sh rustup.sh --disable-sudo
# show backtraces # show backtraces
ENV RUST_BACKTRACE 1 ENV RUST_BACKTRACE 1
# set compiler # set compiler
ENV CXX g++ ENV CXX g++
ENV CC gcc ENV CC gcc
# show tools # show tools
RUN rustc -vV && \ RUN rustc -vV && \
cargo -V && \ cargo -V && \
gcc -v &&\ gcc -v &&\
g++ -v g++ -v
# build parity # build parity
RUN git clone https://github.com/paritytech/parity && \ ADD . /build/parity
cd parity&&\ RUN cd parity&&\
git checkout beta && \ cargo build --release --verbose && \
git pull && \
ls -a&&\
cargo build --release --verbose && \
ls /build/parity/target/release/parity && \ ls /build/parity/target/release/parity && \
strip /build/parity/target/release/parity strip /build/parity/target/release/parity

View File

@ -1,83 +0,0 @@
FROM ubuntu:14.04
MAINTAINER Parity Technologies <devops@parity.io>
WORKDIR /build
#ENV for build TAG
ARG BUILD_TAG
ENV BUILD_TAG ${BUILD_TAG:-master}
RUN echo $BUILD_TAG
# install tools and dependencies
RUN apt-get update && \
apt-get install -y --force-yes --no-install-recommends \
# make
build-essential \
# add-apt-repository
software-properties-common \
make \
curl \
wget \
git \
g++ \
gcc \
libc6 \
libc6-dev \
binutils \
file \
openssl \
libssl-dev \
libudev-dev \
pkg-config \
dpkg-dev \
# evmjit dependencies
zlib1g-dev \
libedit-dev \
libudev-dev &&\
# cmake and llvm ppa's. then update ppa's
add-apt-repository -y "ppa:george-edison55/cmake-3.x" && \
add-apt-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.7 main" && \
apt-get update && \
apt-get install -y --force-yes cmake llvm-3.7-dev && \
# install evmjit
git clone https://github.com/debris/evmjit && \
cd evmjit && \
mkdir build && cd build && \
cmake .. && make && make install && cd && \
# install rustup
curl https://sh.rustup.rs -sSf | sh -s -- -y && \
# rustup directory
PATH=/root/.cargo/bin:$PATH && \
# show backtraces
RUST_BACKTRACE=1 && \
# build parity
cd /build&&git clone https://github.com/paritytech/parity && \
cd parity && \
git pull&& \
git checkout $BUILD_TAG && \
cargo build --verbose --release --features final && \
#ls /build/parity/target/release/parity && \
strip /build/parity/target/release/parity && \
file /build/parity/target/release/parity&&mkdir -p /parity&& cp /build/parity/target/release/parity /parity&&\
#cleanup Docker image
rm -rf /root/.cargo&&rm -rf /root/.multirust&&rm -rf /root/.rustup&&rm -rf /build&&\
apt-get purge -y \
# make
build-essential \
# add-apt-repository
software-properties-common \
make \
curl \
wget \
git \
g++ \
gcc \
binutils \
file \
pkg-config \
dpkg-dev \
# evmjit dependencies
zlib1g-dev \
libedit-dev \
cmake llvm-3.7-dev&&\
rm -rf /var/lib/apt/lists/*
# setup ENTRYPOINT
EXPOSE 8080 8545 8180
ENTRYPOINT ["/parity/parity"]

View File

@ -1,3 +0,0 @@
Usage
```docker build --build-arg BUILD_TAG=branch_or_tag_name --no-cache=true --tag ethcore/parity:branch_or_tag_name .```

View File

@ -1,5 +1,6 @@
FROM ubuntu:14.04 FROM ubuntu:14.04
WORKDIR /build WORKDIR /build
# install tools and dependencies # install tools and dependencies
RUN apt-get -y update && \ RUN apt-get -y update && \
apt-get install -y --force-yes --no-install-recommends \ apt-get install -y --force-yes --no-install-recommends \
@ -24,14 +25,11 @@ RUN rustup target add aarch64-unknown-linux-gnu
ENV RUST_BACKTRACE 1 ENV RUST_BACKTRACE 1
# show tools # show tools
RUN rustc -vV && \ RUN rustc -vV && cargo -V
cargo -V
# build parity # build parity
RUN git clone https://github.com/paritytech/parity && \ ADD . /build/parity
cd parity && \ RUN cd parity && \
git checkout beta && \
git pull && \
mkdir -p .cargo && \ mkdir -p .cargo && \
echo '[target.aarch64-unknown-linux-gnu]\n\ echo '[target.aarch64-unknown-linux-gnu]\n\
linker = "aarch64-linux-gnu-gcc"\n'\ linker = "aarch64-linux-gnu-gcc"\n'\

View File

@ -1,5 +1,6 @@
FROM ubuntu:14.04 FROM ubuntu:14.04
WORKDIR /build WORKDIR /build
# install tools and dependencies # install tools and dependencies
RUN apt-get -y update && \ RUN apt-get -y update && \
apt-get install -y --force-yes --no-install-recommends \ apt-get install -y --force-yes --no-install-recommends \
@ -23,16 +24,12 @@ RUN rustup target add armv7-unknown-linux-gnueabihf
# show backtraces # show backtraces
ENV RUST_BACKTRACE 1 ENV RUST_BACKTRACE 1
# show tools # show tools
RUN rustc -vV && \ RUN rustc -vV && cargo -V
cargo -V
# build parity # build parity
RUN git clone https://github.com/paritytech/parity && \ ADD . /build/parity
cd parity && \ RUN cd parity && \
git checkout beta && \
git pull && \
mkdir -p .cargo && \ mkdir -p .cargo && \
echo '[target.armv7-unknown-linux-gnueabihf]\n\ echo '[target.armv7-unknown-linux-gnueabihf]\n\
linker = "arm-linux-gnueabihf-gcc"\n'\ linker = "arm-linux-gnueabihf-gcc"\n'\

View File

@ -1,37 +0,0 @@
FROM ubuntu:14.04
# install tools and dependencies
RUN apt-get update && \
apt-get install -y \
# make
build-essential \
# add-apt-repository
software-properties-common \
curl \
g++ \
wget \
git \
# evmjit dependencies
zlib1g-dev \
libedit-dev
# cmake, llvm and rocksdb ppas. then update ppas
RUN add-apt-repository -y "ppa:george-edison55/cmake-3.x" && \
add-apt-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.7 main" && \
apt-get update && \
apt-get install -y --force-yes cmake llvm-3.7-dev
# install evmjit
RUN git clone https://github.com/debris/evmjit && \
cd evmjit && \
mkdir build && cd build && \
cmake .. && make && make install && cd
# install rustup
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
# rustup directory
ENV PATH /root/.cargo/bin:$PATH
# show backtraces
ENV RUST_BACKTRACE 1

View File

@ -1,5 +1,6 @@
FROM ubuntu:14.04 FROM ubuntu:14.04
WORKDIR /build WORKDIR /build
# install tools and dependencies # install tools and dependencies
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y \ apt-get install -y \
@ -45,10 +46,8 @@ gcc -v &&\
g++ -v g++ -v
# build parity # build parity
RUN git clone https://github.com/paritytech/parity && \ ADD . /build/parity
cd parity && \ RUN cd parity && \
git checkout beta && \
git pull && \
cargo build --release --features ethcore/jit --verbose && \ cargo build --release --features ethcore/jit --verbose && \
ls /build/parity/target/release/parity && \ ls /build/parity/target/release/parity && \
strip /build/parity/target/release/parity strip /build/parity/target/release/parity

View File

@ -1,40 +0,0 @@
FROM ubuntu:14.04
WORKDIR /build
# install tools and dependencies
RUN apt-get update && \
apt-get install -y \
build-essential \
g++ \
curl \
git \
file \
binutils
# install rustup
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
# rustup directory
ENV PATH /root/.cargo/bin:$PATH
# show backtraces
ENV RUST_BACKTRACE 1
# show tools
RUN rustc -vV && \
cargo -V && \
gcc -v &&\
g++ -v
# build parity
RUN git clone https://github.com/paritytech/parity && \
cd parity && \
git checkout stable && \
git pull && \
cargo build --release --verbose && \
ls /build/parity/target/release/parity && \
strip /build/parity/target/release/parity
RUN file /build/parity/target/release/parity
EXPOSE 8080 8545 8180
ENTRYPOINT ["/build/parity/target/release/parity"]

View File

@ -1,5 +1,6 @@
FROM ubuntu:14.04 FROM ubuntu:14.04
WORKDIR /build WORKDIR /build
# install tools and dependencies # install tools and dependencies
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y \ apt-get install -y \
@ -29,10 +30,8 @@ gcc -v &&\
g++ -v g++ -v
# build parity # build parity
RUN git clone https://github.com/paritytech/parity && \ ADD . /build/parity
cd parity && \ RUN cd parity && \
git checkout beta && \
git pull && \
cargo build --release --verbose && \ cargo build --release --verbose && \
ls /build/parity/target/release/parity && \ ls /build/parity/target/release/parity && \
strip /build/parity/target/release/parity strip /build/parity/target/release/parity