diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d73d494b24a..856cdafc926 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,232 +1,296 @@ stages: - test - - push-release - build + - package + - publish + - docs + +image: parity/rust:gitlab-ci + variables: - RUST_BACKTRACE: "1" - RUSTFLAGS: "" - CARGOFLAGS: "" - CI_SERVER_NAME: "GitLab CI" + CI_SERVER_NAME: "GitLab CI" + CARGO_HOME: "${CI_PROJECT_DIR}/cargo" + + BUILD_TARGET: ubuntu + BUILD_ARCH: amd64 + CARGO_TARGET: x86_64-unknown-linux-gnu + cache: - key: "$CI_BUILD_STAGE-$CI_BUILD_REF_NAME" + key: "${CI_JOB_NAME}" paths: - - target/ - untracked: true -linux-amd64: - stage: build - image: parity/rust:gitlab-ci - only: - - beta - - tags + - ${CI_PROJECT_DIR}/target/ + - ${CI_PROJECT_DIR}/cargo/ + +.releaseable_branches: # list of git refs for building GitLab artifacts (think "pre-release binaries") + only: &releaseable_branches + - master - stable - - triggers - script: - - rustup default stable - # ARGUMENTS: 1. BUILD_PLATFORM (target for binaries) 2. PLATFORM (target for cargo) 3. ARC (architecture) 4. & 5. CC & CXX flags 6. binary identifier - - scripts/gitlab-build.sh x86_64-unknown-linux-gnu x86_64-unknown-linux-gnu amd64 gcc g++ linux - tags: - - rust-stable - artifacts: - paths: - - parity.zip - name: "stable-x86_64-unknown-linux-gnu_parity" -linux-i686: - stage: build - image: parity/rust-i686:gitlab-ci - only: - beta - tags - - stable - - triggers - script: - - scripts/gitlab-build.sh i686-unknown-linux-gnu i686-unknown-linux-gnu i386 gcc g++ linux - tags: - - rust-i686 + +.publishable_branches: # list of git refs for publishing builds to the "production" locations + only: &publishable_branches + - nightly # Our nightly builds from schedule, on `master` + - "v2*" # Our version tags + +.collect_artifacts: &collect_artifacts artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" + when: on_success + expire_in: 1 mos paths: - - parity.zip - name: "i686-unknown-linux-gnu" - allow_failure: true -linux-armv7: - stage: build - image: parity/rust-armv7:gitlab-ci - only: - - beta - - tags - - stable - - triggers + - artifacts/ + +.determine_version: &determine_version | + export VERSION=$(grep -m 1 "version =" Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n") + echo "Version" $VERSION + + +#### stage: test + +test-rust-stable: &test + stage: test script: - - scripts/gitlab-build.sh armv7-unknown-linux-gnueabihf armv7-unknown-linux-gnueabihf armhf arm-linux-gnueabihf-gcc arm-linux-gnueabihf-g++ linux + - scripts/gitlab/test.sh stable tags: - - rust-arm - artifacts: - paths: - - parity.zip - name: "armv7_unknown_linux_gnueabihf_parity" - allow_failure: true -linux-armhf: - stage: build - image: parity/rust-arm:gitlab-ci + - rust-stable + +.optional_test: &optional_test + <<: *test + allow_failure: true only: - - beta - - tags - - stable - - triggers + - master + +test-rust-beta: + <<: *optional_test script: - - scripts/gitlab-build.sh arm-unknown-linux-gnueabihf arm-unknown-linux-gnueabihf armhf arm-linux-gnueabihf-gcc arm-linux-gnueabihf-g++ linux - tags: - - rust-arm - artifacts: - paths: - - parity.zip - name: "arm-unknown-linux-gnueabihf_parity" - allow_failure: true -linux-aarch64: - stage: build - image: parity/rust-arm64:gitlab-ci + - scripts/gitlab/test.sh beta + +test-rust-nightly: + <<: *optional_test + script: + - scripts/gitlab/test.sh nightly + +test-lint-rustfmt: + <<: *optional_test + script: + - scripts/gitlab/rustfmt.sh + +test-lint-clippy: + <<: *optional_test + script: + - scripts/gitlab/clippy.sh + +test-coverage-kcov: + stage: test only: - - beta - - tags - - stable - - triggers + - master script: - - scripts/gitlab-build.sh aarch64-unknown-linux-gnu aarch64-unknown-linux-gnu arm64 aarch64-linux-gnu-gcc aarch64-linux-gnu-g++ linux + - scripts/gitlab/coverage.sh tags: - - rust-arm - artifacts: - paths: - - parity.zip - name: "aarch64-unknown-linux-gnu_parity" -linux-snap: - stage: build - image: parity/snapcraft:gitlab-ci - only: - - stable - - beta - - tags - - triggers + - shell + allow_failure: true + + +#### stage: build + +build-linux-ubuntu-amd64: &build + stage: build + only: *releaseable_branches + variables: + CARGO_TARGET: x86_64-unknown-linux-gnu script: - - scripts/gitlab-build.sh x86_64-unknown-snap-gnu x86_64-unknown-linux-gnu amd64 gcc g++ snap + - scripts/gitlab/build-unix.sh + <<: *collect_artifacts tags: - rust-stable - artifacts: - paths: - - parity.zip - name: "stable-x86_64-unknown-snap-gnu_parity" -darwin: - stage: build - only: - - beta - - tags - - stable - - triggers - script: - - scripts/gitlab-build.sh x86_64-apple-darwin x86_64-apple-darwin macos gcc g++ macos + allow_failure: true + +build-linux-ubuntu-i386: + <<: *build + image: parity/rust-i686:gitlab-ci + variables: + CARGO_TARGET: i686-unknown-linux-gnu + +build-linux-ubuntu-arm64: + <<: *build + image: parity/rust-arm64:gitlab-ci + variables: + CARGO_TARGET: aarch64-unknown-linux-gnu + +build-linux-ubuntu-armhf: + <<: *build + image: parity/rust-armv7:gitlab-ci + variables: + CARGO_TARGET: armv7-unknown-linux-gnueabihf + +build-linux-android-armhf: + <<: *build + image: parity/rust-android:gitlab-ci + variables: + CARGO_TARGET: armv7-linux-androideabi + +build-darwin-macos-x86_64: + <<: *build + variables: + CARGO_TARGET: x86_64-apple-darwin + CC: gcc + CXX: g++ tags: - osx - artifacts: - paths: - - parity.zip - name: "x86_64-apple-darwin_parity" -windows: + <<: *collect_artifacts + +build-windows-msvc-x86_64: + stage: build + only: *releaseable_branches cache: - key: "%CI_BUILD_STAGE%-%CI_BUILD_REF_NAME%" - untracked: true - stage: build - only: - - beta - - tags - - stable - - triggers + key: "%CI_JOB_NAME%" + paths: + - "%CI_PROJECT_DIR%/target/" + - "%CI_PROJECT_DIR%/cargo/" + # No cargo caching, since fetch-locking on Windows gets stuck + variables: + CARGO_TARGET: x86_64-pc-windows-msvc script: - - sh scripts/gitlab-build.sh x86_64-pc-windows-msvc x86_64-pc-windows-msvc amd64 "" "" windows + - sh scripts/gitlab/build-windows.sh tags: - rust-windows - artifacts: - paths: - - parity.zip - name: "x86_64-pc-windows-msvc_parity" -android-armv7: - stage: build - image: parity/parity-android:latest - only: - - beta - - tags - - stable - - triggers + <<: *collect_artifacts + + +#### stage: package + +package-linux-snap-amd64: &package_snap + stage: package + only: *releaseable_branches + cache: {} + before_script: + - *determine_version + variables: + CARGO_TARGET: x86_64-unknown-linux-gnu + dependencies: + - build-linux-ubuntu-amd64 script: - - cargo build --target=armv7-linux-androideabi + - scripts/gitlab/package-snap.sh tags: - - rust-arm - allow_failure: true - artifacts: - paths: - - parity.zip - name: "armv7-linux-androideabi_parity" -docker-build: - stage: build - only: - - tags - - master - - beta - - stable - - triggers + - rust-stable + <<: *collect_artifacts + +package-linux-snap-i386: + <<: *package_snap + variables: + BUILD_ARCH: i386 + CARGO_TARGET: i686-unknown-linux-gnu + dependencies: + - build-linux-ubuntu-i386 + +package-linux-snap-arm64: + <<: *package_snap + variables: + BUILD_ARCH: arm64 + CARGO_TARGET: aarch64-unknown-linux-gnu + dependencies: + - build-linux-ubuntu-arm64 + +package-linux-snap-armhf: + <<: *package_snap + variables: + BUILD_ARCH: armhf + CARGO_TARGET: armv7-unknown-linux-gnueabihf + dependencies: + - build-linux-ubuntu-armhf + + +#### stage: publish + +publish-linux-snap-amd64: &publish_snap + stage: publish + only: *publishable_branches + image: snapcore/snapcraft:stable + cache: {} before_script: - - docker info + - *determine_version + variables: + BUILD_ARCH: amd64 + dependencies: + - package-linux-snap-amd64 script: - - if [ "$CI_BUILD_REF_NAME" == "master" ]; then DOCKER_TAG="latest"; else DOCKER_TAG=$CI_BUILD_REF_NAME; fi - - echo "Tag:" $DOCKER_TAG - - docker login -u $Docker_Hub_User_Parity -p $Docker_Hub_Pass_Parity - - scripts/docker-build.sh $DOCKER_TAG - - docker logout + - scripts/gitlab/publish-snap.sh tags: - - docker -test-coverage: - stage: test - only: - - master - script: - - scripts/gitlab-test.sh test-coverage + - rust-stable + +publish-linux-snap-i386: + <<: *publish_snap + before_script: + - *determine_version + variables: + BUILD_ARCH: i386 + dependencies: + - package-linux-snap-i386 + +publish-linux-snap-arm64: + <<: *publish_snap + before_script: + - *determine_version + variables: + BUILD_ARCH: arm64 + dependencies: + - package-linux-snap-arm64 + +publish-linux-snap-armhf: + <<: *publish_snap + before_script: + - *determine_version + variables: + BUILD_ARCH: armhf + dependencies: + - package-linux-snap-armhf + +publish-docker-parity-amd64: &publish_docker + stage: publish + only: *publishable_branches + cache: {} + dependencies: + - build-linux-ubuntu-amd64 tags: - - kcov - allow_failure: true -test-rust-stable: - stage: test - image: parity/rust:gitlab-ci + - shell + allow_failure: true script: - - scripts/gitlab-test.sh stable - tags: - - rust-stable -test-rust-beta: - stage: test - only: - - triggers - - master - image: parity/rust:gitlab-ci + - scripts/gitlab/publish-docker.sh parity + +publish-docker-parityevm-amd64: + <<: *publish_docker script: - - scripts/gitlab-test.sh beta - tags: - - rust-beta - allow_failure: true -test-rust-nightly: - stage: test - only: - - triggers - - master - image: parity/rust:gitlab-ci + - scripts/gitlab/publish-docker.sh parity-evm + +publish-github-and-s3: + stage: publish + only: *publishable_branches + cache: {} + dependencies: + - build-linux-ubuntu-amd64 + - build-linux-ubuntu-i386 + - build-linux-ubuntu-armhf + - build-linux-ubuntu-arm64 + - build-darwin-macos-x86_64 + - build-windows-msvc-x86_64 + before_script: + - *determine_version script: - - scripts/gitlab-test.sh nightly + - scripts/gitlab/push.sh tags: - - rust - - rust-nightly - allow_failure: true -push-release: - stage: push-release + - shell + allow_failure: true + + +####stage: docs + +docs-rpc-json: + stage: docs only: - tags - - triggers - image: parity/rust:gitlab-ci + cache: {} script: - - scripts/gitlab-push-release.sh + - scripts/gitlab/rpc-docs.sh tags: - - curl + - shell diff --git a/Cargo.lock b/Cargo.lock index 9443798fa28..6d323fcbdac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -741,6 +741,7 @@ dependencies = [ "ethkey 0.3.0", "fetch 0.1.0", "futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)", + "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -756,6 +757,7 @@ dependencies = [ "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "transaction-pool 1.13.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -808,6 +810,7 @@ dependencies = [ "ethcore-io 1.12.0", "ethcore-private-tx 1.0.0", "ethcore-sync 1.12.0", + "ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb-rocksdb 0.1.2-beta.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2173,6 +2176,7 @@ dependencies = [ "ethstore 0.2.0", "fake-fetch 0.0.1", "fake-hardware-wallet 0.0.1", + "fastmap 0.1.0", "fetch 0.1.0", "futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/README.md b/README.md index 40c04dff727..88138b78cb5 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,44 @@ -## Parity-Ethereum - a fast, light, and robust EVM and WASM blockchain client +![Parity Ethereum](docs/logo-parity-ethereum.svg) -### [» Download the latest release «](https://github.com/paritytech/parity-ethereum/releases/latest) +## The fastest and most advanced Ethereum client. -[![build status](https://gitlab.parity.io/parity/parity/badges/master/build.svg)](https://gitlab.parity.io/parity/parity/commits/master) -[![codecov](https://codecov.io/gh/paritytech/parity-ethereum/branch/master/graph/badge.svg)](https://codecov.io/gh/paritytech/parity-ethereum) -[![Snap Status](https://build.snapcraft.io/badge/paritytech/parity.svg)](https://build.snapcraft.io/user/paritytech/parity) -[![GPLv3](https://img.shields.io/badge/license-GPL%20v3-green.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) +
» Download the latest release «
+ -### Join the chat! +**Built for mission-critical use**: Miners, service providers, and exchanges need fast synchronisation and maximum uptime. Parity Ethereum provides the core infrastructure essential for speedy and reliable services. -Get in touch with us on Gitter: -[![Gitter: Parity](https://img.shields.io/badge/gitter-parity-4AB495.svg)](https://gitter.im/paritytech/parity) -[![Gitter: Parity.js](https://img.shields.io/badge/gitter-parity.js-4AB495.svg)](https://gitter.im/paritytech/parity.js) -[![Gitter: Parity/Miners](https://img.shields.io/badge/gitter-parity/miners-4AB495.svg)](https://gitter.im/paritytech/parity/miners) -[![Gitter: Parity-PoA](https://img.shields.io/badge/gitter-parity--poa-4AB495.svg)](https://gitter.im/paritytech/parity-poa) - -Or join our community on Matrix: -[![Riot: +Parity](https://img.shields.io/badge/riot-%2Bparity%3Amatrix.parity.io-orange.svg)](https://riot.im/app/#/group/+parity:matrix.parity.io) +- Clean, modular codebase for easy customisation +- Advanced CLI-based client +- Minimal memory and storage footprint +- Synchronise in hours, not days with Warp Sync +- Modular for light integration into your service or product -Official website: https://parity.io | Be sure to check out [our wiki](https://wiki.parity.io) for more information. +## Technical Overview ----- +Parity Ethereum's goal is to be the fastest, lightest, and most secure Ethereum client. We are developing Parity Ethereum using the sophisticated and cutting-edge **Rust programming language**. Parity Ethereum is licensed under the GPLv3 and can be used for all your Ethereum needs. -## About Parity-Ethereum +By default, Parity Ethereum runs a JSON-RPC HTTP server on port `:8545` and a Web-Sockets server on port `:8546`. This is fully configurable and supports a number of APIs. -Parity-Ethereum's goal is to be the fastest, lightest, and most secure Ethereum client. We are developing Parity-Ethereum using the sophisticated and cutting-edge Rust programming language. Parity-Ethereum is licensed under the GPLv3, and can be used for all your Ethereum needs. +If you run into problems while using Parity Ethereum, check out the [wiki for documentation](https://wiki.parity.io/), feel free to [file an issue in this repository](https://github.com/paritytech/parity-ethereum/issues/new), or hop on our [Gitter](https://gitter.im/paritytech/parity) or [Riot](https://riot.im/app/#/group/+parity:matrix.parity.io) chat room to ask a question. We are glad to help! **For security-critical issues**, please refer to the security policy outlined in [SECURITY.md](SECURITY.md). -By default, Parity-Ethereum will run a JSON-RPC HTTP server on `127.0.0.1:8545` and a Web-Sockets server on `127.0.0.1:8546`. This is fully configurable and supports a number of APIs. +Parity Ethereum's current beta-release is 2.0. You can download it at [the releases page](https://github.com/paritytech/parity-ethereum/releases) or follow the instructions below to build from source. Please, mind the [CHANGELOG.md](CHANGELOG.md) for a list of all changes between different versions. -If you run into problems while using Parity-Ethereum, feel free to file an issue in this repository or hop on our [Gitter](https://gitter.im/paritytech/parity) or [Riot](https://riot.im/app/#/group/+parity:matrix.parity.io) chat room to ask a question. We are glad to help! **For security-critical issues**, please refer to the security policy outlined in [SECURITY.md](SECURITY.md). +## Build Dependencies -Parity-Ethereum's current beta-release is 2.0. You can download it at [the releases page](https://github.com/paritytech/parity-ethereum/releases) or follow the instructions below to build from source. Please, mind the [CHANGELOG.md](CHANGELOG.md) for a list of all changes between different versions. +Parity Ethereum requires **Rust version 1.28.x** to build. ----- - -## Build dependencies - -**Parity-Ethereum requires Rust version 1.27.0 to build** - -We recommend installing Rust through [rustup](https://www.rustup.rs/). If you don't already have rustup, you can install it like this: +We recommend installing Rust through [rustup](https://www.rustup.rs/). If you don't already have `rustup`, you can install it like this: - Linux: ```bash $ curl https://sh.rustup.rs -sSf | sh ``` - Parity-Ethereum also requires `gcc`, `g++`, `libudev-dev`, `pkg-config`, `file`, `make`, and `cmake` packages to be installed. + Parity Ethereum also requires `gcc`, `g++`, `libudev-dev`, `pkg-config`, `file`, `make`, and `cmake` packages to be installed. - OSX: ```bash @@ -56,21 +48,19 @@ We recommend installing Rust through [rustup](https://www.rustup.rs/). If you do `clang` is required. It comes with Xcode command line tools or can be installed with homebrew. - Windows - Make sure you have Visual Studio 2015 with C++ support installed. Next, download and run the rustup installer from - https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe, start "VS2015 x64 Native Tools Command Prompt", and use the following command to install and set up the msvc toolchain: + Make sure you have Visual Studio 2015 with C++ support installed. Next, download and run the `rustup` installer from + https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe, start "VS2015 x64 Native Tools Command Prompt", and use the following command to install and set up the `msvc` toolchain: ```bash $ rustup default stable-x86_64-pc-windows-msvc ``` -Once you have rustup installed, then you need to install: +Once you have `rustup` installed, then you need to install: * [Perl](https://www.perl.org) * [Yasm](https://yasm.tortall.net) -Make sure that these binaries are in your `PATH`. After that you should be able to build Parity-Ethereum from source. +Make sure that these binaries are in your `PATH`. After that, you should be able to build Parity Ethereum from source. ----- - -## Install from the snap store +## Install from the Snapcraft Store In any of the [supported Linux distros](https://snapcraft.io/docs/core/install): @@ -78,24 +68,22 @@ In any of the [supported Linux distros](https://snapcraft.io/docs/core/install): sudo snap install parity ``` -Or, if you want to contribute testing the upcoming release: +Alternatively, if you want to contribute testing the upcoming release: ```bash sudo snap install parity --beta ``` -And to test the latest code landed into the master branch: +Moreover, to test the latest code from the master branch: ```bash sudo snap install parity --edge ``` ----- - -## Build from source +## Build from Source Code ```bash -# download Parity-Ethereum code +# download Parity Ethereum code $ git clone https://github.com/paritytech/parity-ethereum $ cd parity-ethereum @@ -103,7 +91,7 @@ $ cd parity-ethereum $ cargo build --release --features final ``` -This will produce an executable in the `./target/release` subdirectory. +This produces an executable in the `./target/release` subdirectory. Note: if cargo fails to parse manifest try: @@ -117,7 +105,7 @@ Note, when compiling a crate and you receive errors, it's in most cases your out $ cargo clean ``` -This will always compile the latest nightly builds. If you want to build stable or beta, do a +This always compiles the latest nightly builds. If you want to build stable or beta, do a ```bash $ git checkout stable @@ -129,11 +117,7 @@ or $ git checkout beta ``` -first. - ----- - -## Simple one-line installer for Mac and Ubuntu +## Simple One-Line Installer for Mac and Linux ```bash bash <(curl https://get.parity.io -L) @@ -145,22 +129,39 @@ The one-line installer always defaults to the latest beta release. To install a bash <(curl https://get.parity.io -L) -r stable ``` -## Start Parity-Ethereum +## Start Parity Ethereum ### Manually -To start Parity-Ethereum manually, just run +To start Parity Ethereum manually, just run ```bash $ ./target/release/parity ``` -and Parity-Ethereum will begin syncing the Ethereum blockchain. +so Parity Ethereum begins syncing the Ethereum blockchain. -### Using systemd service file +### Using `systemd` service file -To start Parity-Ethereum as a regular user using systemd init: +To start Parity Ethereum as a regular user using `systemd` init: 1. Copy `./scripts/parity.service` to your -systemd user directory (usually `~/.config/systemd/user`). -2. To configure Parity-Ethereum, write a `/etc/parity/config.toml` config file, see [Configuring Parity-Ethereum](https://paritytech.github.io/wiki/Configuring-Parity) for details. +`systemd` user directory (usually `~/.config/systemd/user`). +2. To configure Parity Ethereum, write a `/etc/parity/config.toml` config file, see [Configuring Parity Ethereum](https://paritytech.github.io/wiki/Configuring-Parity) for details. + +## Join the chat! + +Questions? Get in touch with us on Gitter: +[![Gitter: Parity](https://img.shields.io/badge/gitter-parity-4AB495.svg)](https://gitter.im/paritytech/parity) +[![Gitter: Parity.js](https://img.shields.io/badge/gitter-parity.js-4AB495.svg)](https://gitter.im/paritytech/parity.js) +[![Gitter: Parity/Miners](https://img.shields.io/badge/gitter-parity/miners-4AB495.svg)](https://gitter.im/paritytech/parity/miners) +[![Gitter: Parity-PoA](https://img.shields.io/badge/gitter-parity--poa-4AB495.svg)](https://gitter.im/paritytech/parity-poa) + +Alternatively, join our community on Matrix: +[![Riot: +Parity](https://img.shields.io/badge/riot-%2Bparity%3Amatrix.parity.io-orange.svg)](https://riot.im/app/#/group/+parity:matrix.parity.io) + +## Documentation + +Official website: https://parity.io + +Be sure to [check out our wiki](https://wiki.parity.io) for more information. diff --git a/docker/README.md b/docker/README.md index 3b79e8dd754..b2f8374b59e 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,3 +1,42 @@ -Usage +## Usage ```docker build -f docker/ubuntu/Dockerfile --tag ethcore/parity:branch_or_tag_name .``` + +## Usage - CentOS + +Builds a lightweight non-root Parity docker image: + +``` +git clone https://github.com/paritytech/parity-ethereum.git +cd parity-ethereum +./docker/centos/build.sh +``` + +Fully customised build: +``` +PARITY_IMAGE_REPO=my-personal/parity \ +PARITY_BUILDER_IMAGE_TAG=build-latest \ +PARITY_RUNNER_IMAGE_TAG=centos-parity-experimental \ +./docker/centos/build.sh +``` + + +Default values: +``` +# The image name +PARITY_IMAGE_REPO - parity/parity + +# The tag to be used for builder image, git commit sha will be appended +PARITY_BUILDER_IMAGE_TAG - build + +# The tag to be used for runner image +PARITY_RUNNER_IMAGE_TAG - latest +``` + +All default ports you might use will be exposed: +``` +# secret +# ipfs store ui rpc ws listener discovery +# ↓ ↓ ↓ ↓ ↓ ↓ ↓ +EXPOSE 5001 8082 8083 8180 8545 8546 30303/tcp 30303/udp +``` diff --git a/docker/centos/Dockerfile b/docker/centos/Dockerfile index 7c944001e2c..22a98c003ae 100644 --- a/docker/centos/Dockerfile +++ b/docker/centos/Dockerfile @@ -1,36 +1,28 @@ FROM centos:latest -WORKDIR /build -# install tools and dependencies -RUN yum -y update&& \ - yum install -y git make gcc-c++ gcc file binutils cmake +RUN mkdir -p /opt/parity/data && \ + chmod g+rwX /opt/parity/data && \ + mkdir -p /opt/parity/release -# install rustup -RUN curl -sSf https://static.rust-lang.org/rustup.sh -o rustup.sh &&\ -ls&&\ - sh rustup.sh --disable-sudo +COPY parity/parity /opt/parity/release -# show backtraces -ENV RUST_BACKTRACE 1 +WORKDIR /opt/parity/data -# set compiler -ENV CXX g++ -ENV CC gcc +# exposing default ports +# +# secret +# ipfs store ui rpc ws listener discovery +# ↓ ↓ ↓ ↓ ↓ ↓ ↓ +EXPOSE 5001 8082 8083 8180 8545 8546 30303/tcp 30303/udp -# show tools -RUN rustc -vV && \ -cargo -V && \ -gcc -v &&\ -g++ -v +# switch to non-root user +USER 1001 -# build parity -ADD . /build/parity -RUN cd parity&&\ - cargo build --release --verbose && \ - ls /build/parity/target/release/parity && \ - strip /build/parity/target/release/parity +#if no base path provided, assume it's current workdir +CMD ["--base-path","."] +ENTRYPOINT ["/opt/parity/release/parity"] + + + -RUN file /build/parity/target/release/parity -EXPOSE 8080 8545 8180 -ENTRYPOINT ["/build/parity/target/release/parity"] diff --git a/docker/centos/Dockerfile.build b/docker/centos/Dockerfile.build new file mode 100644 index 00000000000..454af403a03 --- /dev/null +++ b/docker/centos/Dockerfile.build @@ -0,0 +1,25 @@ +FROM centos:latest + +WORKDIR /build + +ADD . /build/parity-ethereum + +RUN yum -y update && \ + yum install -y systemd-devel git make gcc-c++ gcc file binutils && \ + curl -L "https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz" -o cmake.tar.gz && \ + tar -xzf cmake.tar.gz && \ + cp -r cmake-3.12.0-Linux-x86_64/* /usr/ && \ + curl https://sh.rustup.rs -sSf | sh -s -- -y && \ + PATH=/root/.cargo/bin:$PATH && \ + RUST_BACKTRACE=1 && \ + rustc -vV && \ + cargo -V && \ + gcc -v && \ + g++ -v && \ + cmake --version && \ + cd parity-ethereum && \ + cargo build --verbose --release --features final && \ + strip /build/parity-ethereum/target/release/parity && \ + file /build/parity-ethereum/target/release/parity + + diff --git a/docker/centos/build.sh b/docker/centos/build.sh new file mode 100755 index 00000000000..7215e745f0e --- /dev/null +++ b/docker/centos/build.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env sh + +# The image name +PARITY_IMAGE_REPO=${PARITY_IMAGE_REPO:-parity/parity} +# The tag to be used for builder image +PARITY_BUILDER_IMAGE_TAG=${PARITY_BUILDER_IMAGE_TAG:-build} +# The tag to be used for runner image +PARITY_RUNNER_IMAGE_TAG=${PARITY_RUNNER_IMAGE_TAG:-latest} + +echo Building $PARITY_IMAGE_REPO:$PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H") +docker build --no-cache -t $PARITY_IMAGE_REPO:$PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H") . -f docker/centos/Dockerfile.build + +echo Creating $PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H"), extracting binary +docker create --name extract $PARITY_IMAGE_REPO:$PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H") +mkdir docker/centos/parity +docker cp extract:/build/parity-ethereum/target/release/parity docker/centos/parity + +echo Building $PARITY_IMAGE_REPO:$PARITY_RUNNER_IMAGE_TAG +docker build --no-cache -t $PARITY_IMAGE_REPO:$PARITY_RUNNER_IMAGE_TAG docker/centos/ -f docker/centos/Dockerfile + +echo Cleaning up ... +rm -rf docker/centos/parity +docker rm -f extract +docker rmi -f $PARITY_IMAGE_REPO:$PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H") + +echo Echoing Parity version: +docker run $PARITY_IMAGE_REPO:$PARITY_RUNNER_IMAGE_TAG --version + +echo Done. diff --git a/docker/hub/Dockerfile b/docker/hub/Dockerfile index eb007dc10a8..4eec8cfc61c 100644 --- a/docker/hub/Dockerfile +++ b/docker/hub/Dockerfile @@ -1,64 +1,27 @@ FROM ubuntu:xenial MAINTAINER Parity Technologies