Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

nonroot CentOS Dockerfile #9231

Closed
Closed
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
8c8ea20
wip buildable centos docker file
JohnnySheffield Jul 26, 2018
6d51a23
fixes port number
JohnnySheffield Jul 26, 2018
90fcf76
installing deps in on RUN command, adding comments
JohnnySheffield Jul 27, 2018
942ca80
cleaning after installation
JohnnySheffield Jul 27, 2018
b9dee6b
add -p to mkdir
JohnnySheffield Jul 27, 2018
611ef25
Merge branch 'master' into docker-centos
JohnnySheffield Jul 27, 2018
2b78c80
removing systemd is a no-no
JohnnySheffield Jul 27, 2018
0fc5af1
cleanup
JohnnySheffield Jul 27, 2018
93bd6bb
fix entrypooint
JohnnySheffield Jul 28, 2018
b5a8f20
formatting and cleaning
Dec- Jul 28, 2018
781b40f
Merge pull request #1 from Dec-/patch-1
JohnnySheffield Jul 28, 2018
be7fcb6
free up space taken by orphaned data from disabled or removed repos
JohnnySheffield Jul 29, 2018
b840543
reworking image to pull parity from git
JohnnySheffield Jul 29, 2018
10e6937
pulling parity from git, new BUILD_REPO argument to allow for differe…
JohnnySheffield Jul 29, 2018
28a04c6
fix
JohnnySheffield Jul 29, 2018
c5fc77f
fix
JohnnySheffield Jul 29, 2018
092b762
align rust installation
JohnnySheffield Jul 29, 2018
cb5bfc1
set env
JohnnySheffield Jul 29, 2018
119c07a
cleanup
JohnnySheffield Jul 29, 2018
0510f8e
cleanup
JohnnySheffield Jul 29, 2018
dcb5710
builder pattern - splitting up the problem on two docker files and a …
JohnnySheffield Jul 30, 2018
a809621
Increase the number of sessions. (#9203)
tomusdrw Jul 30, 2018
c54beba
block cleanup (#9117)
debris Jul 30, 2018
771ea47
Update Dockerfile (#9242)
General-Beck Jul 30, 2018
f981438
Improve Tracer documentation (#9237)
udoprog Jul 30, 2018
a59ee34
Expose all default ports that could be used by Parity, set non-root u…
JohnnySheffield Jul 30, 2018
76b952f
Rename builder image ARG and ENV variables to more distinct name
JohnnySheffield Jul 30, 2018
a46dc57
Allow script configuration with env variables, add some echoes for a …
JohnnySheffield Jul 30, 2018
29baccd
Implement EIP-1052 (EXTCODEHASH) and fix several issues in state acco…
sorpaas Jul 31, 2018
10f42a2
removed client error (#9253)
debris Jul 31, 2018
f0c0da8
Check if synced when using eth_getWork (#9193) (#9210)
mttmartin Jul 31, 2018
ceff3e1
Using ADD instead of git clone
JohnnySheffield Jul 31, 2018
8bf0ce1
Echo commit hash that is being used for building, print out Parity ve…
JohnnySheffield Jul 31, 2018
7900490
add echo for parity version
JohnnySheffield Jul 31, 2018
329adb4
add context
JohnnySheffield Jul 31, 2018
a2329c6
append git sha to the builder image, update readme
JohnnySheffield Jul 31, 2018
8db96bd
optimising build context to include only what is necessary
JohnnySheffield Jul 31, 2018
637883f
Comply EIP-86 with the new definition (#9140)
sorpaas Aug 1, 2018
c224980
Update ref to `parity-common` and update `seek` behaviour (#9257)
ngotchac Aug 1, 2018
f442665
Fix eternalities tests can_create (missing parameter) (#9270)
cheme Aug 2, 2018
b4ae1b6
decode block rlp less often (#9252)
debris Aug 2, 2018
9a658c3
update shebang
JohnnySheffield Aug 2, 2018
90d7823
Propagate transactions for next 4 blocks. (#9265)
tomusdrw Aug 2, 2018
782f09c
Remove empty continuation lines as they will become errors in a futur…
JohnnySheffield Aug 2, 2018
0cfc6bf
Fix path to parity.h (#9274)
tomaka Aug 2, 2018
25604dc
Avoid using $HOME if not necessary (#9273)
tomaka Aug 3, 2018
54a8368
Clean up the builder image
JohnnySheffield Aug 3, 2018
cbf08a7
wip buildable centos docker file
JohnnySheffield Jul 26, 2018
57ee2b1
fixes port number
JohnnySheffield Jul 26, 2018
3d9a07d
installing deps in on RUN command, adding comments
JohnnySheffield Jul 27, 2018
caeeeb0
cleaning after installation
JohnnySheffield Jul 27, 2018
6298ef3
add -p to mkdir
JohnnySheffield Jul 27, 2018
05f1de4
removing systemd is a no-no
JohnnySheffield Jul 27, 2018
213fe9a
cleanup
JohnnySheffield Jul 27, 2018
42c9a50
fix entrypooint
JohnnySheffield Jul 28, 2018
e33141a
formatting and cleaning
Dec- Jul 28, 2018
f9a945c
free up space taken by orphaned data from disabled or removed repos
JohnnySheffield Jul 29, 2018
c9a43df
reworking image to pull parity from git
JohnnySheffield Jul 29, 2018
a158dd0
pulling parity from git, new BUILD_REPO argument to allow for differe…
JohnnySheffield Jul 29, 2018
ce96e3c
fix
JohnnySheffield Jul 29, 2018
43785e3
fix
JohnnySheffield Jul 29, 2018
ae26991
align rust installation
JohnnySheffield Jul 29, 2018
e7dcd01
set env
JohnnySheffield Jul 29, 2018
bb93d79
cleanup
JohnnySheffield Jul 29, 2018
4ea5baa
cleanup
JohnnySheffield Jul 29, 2018
8592fcf
builder pattern - splitting up the problem on two docker files and a …
JohnnySheffield Jul 30, 2018
14c7082
Expose all default ports that could be used by Parity, set non-root u…
JohnnySheffield Jul 30, 2018
5205220
Rename builder image ARG and ENV variables to more distinct name
JohnnySheffield Jul 30, 2018
4e6ceea
Allow script configuration with env variables, add some echoes for a …
JohnnySheffield Jul 30, 2018
63b3da2
Using ADD instead of git clone
JohnnySheffield Jul 31, 2018
1b8820d
Echo commit hash that is being used for building, print out Parity ve…
JohnnySheffield Jul 31, 2018
3a46d7f
add echo for parity version
JohnnySheffield Jul 31, 2018
d4330ce
add context
JohnnySheffield Jul 31, 2018
1d486cb
append git sha to the builder image, update readme
JohnnySheffield Jul 31, 2018
c6a7ab2
optimising build context to include only what is necessary
JohnnySheffield Jul 31, 2018
671a1de
update shebang
JohnnySheffield Aug 2, 2018
09ee1a0
Remove empty continuation lines as they will become errors in a futur…
JohnnySheffield Aug 2, 2018
a4c93e0
Clean up the builder image
JohnnySheffield Aug 3, 2018
efe3e45
Merge branch 'docker-centos' of github.com:JohnnySheffield/parity-eth…
JohnnySheffield Aug 3, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
@@ -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
```
46 changes: 19 additions & 27 deletions docker/centos/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
25 changes: 25 additions & 0 deletions docker/centos/build.Dockerfile
Original file line number Diff line number Diff line change
@@ -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


28 changes: 28 additions & 0 deletions docker/centos/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/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/build.Dockerfile

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@niklasad1 @General-Beck I'm not sure should we clean up the builder image here? so something like
docker rmi --force $PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove it since the builder images will just pile up if we dont


echo Echoing Parity version:
docker run $PARITY_IMAGE_REPO:$PARITY_RUNNER_IMAGE_TAG --version

echo Done.