This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
nonroot CentOS Dockerfile #9231
Closed
JohnnySheffield
wants to merge
79
commits into
openethereum:master
from
JohnnySheffield:docker-centos
Closed
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 6d51a23
fixes port number
JohnnySheffield 90fcf76
installing deps in on RUN command, adding comments
JohnnySheffield 942ca80
cleaning after installation
JohnnySheffield b9dee6b
add -p to mkdir
JohnnySheffield 611ef25
Merge branch 'master' into docker-centos
JohnnySheffield 2b78c80
removing systemd is a no-no
JohnnySheffield 0fc5af1
cleanup
JohnnySheffield 93bd6bb
fix entrypooint
JohnnySheffield b5a8f20
formatting and cleaning
Dec- 781b40f
Merge pull request #1 from Dec-/patch-1
JohnnySheffield be7fcb6
free up space taken by orphaned data from disabled or removed repos
JohnnySheffield b840543
reworking image to pull parity from git
JohnnySheffield 10e6937
pulling parity from git, new BUILD_REPO argument to allow for differe…
JohnnySheffield 28a04c6
fix
JohnnySheffield c5fc77f
fix
JohnnySheffield 092b762
align rust installation
JohnnySheffield cb5bfc1
set env
JohnnySheffield 119c07a
cleanup
JohnnySheffield 0510f8e
cleanup
JohnnySheffield dcb5710
builder pattern - splitting up the problem on two docker files and a …
JohnnySheffield a809621
Increase the number of sessions. (#9203)
tomusdrw c54beba
block cleanup (#9117)
debris 771ea47
Update Dockerfile (#9242)
General-Beck f981438
Improve Tracer documentation (#9237)
udoprog a59ee34
Expose all default ports that could be used by Parity, set non-root u…
JohnnySheffield 76b952f
Rename builder image ARG and ENV variables to more distinct name
JohnnySheffield a46dc57
Allow script configuration with env variables, add some echoes for a …
JohnnySheffield 29baccd
Implement EIP-1052 (EXTCODEHASH) and fix several issues in state acco…
sorpaas 10f42a2
removed client error (#9253)
debris f0c0da8
Check if synced when using eth_getWork (#9193) (#9210)
mttmartin ceff3e1
Using ADD instead of git clone
JohnnySheffield 8bf0ce1
Echo commit hash that is being used for building, print out Parity ve…
JohnnySheffield 7900490
add echo for parity version
JohnnySheffield 329adb4
add context
JohnnySheffield a2329c6
append git sha to the builder image, update readme
JohnnySheffield 8db96bd
optimising build context to include only what is necessary
JohnnySheffield 637883f
Comply EIP-86 with the new definition (#9140)
sorpaas c224980
Update ref to `parity-common` and update `seek` behaviour (#9257)
ngotchac f442665
Fix eternalities tests can_create (missing parameter) (#9270)
cheme b4ae1b6
decode block rlp less often (#9252)
debris 9a658c3
update shebang
JohnnySheffield 90d7823
Propagate transactions for next 4 blocks. (#9265)
tomusdrw 782f09c
Remove empty continuation lines as they will become errors in a futur…
JohnnySheffield 0cfc6bf
Fix path to parity.h (#9274)
tomaka 25604dc
Avoid using $HOME if not necessary (#9273)
tomaka 54a8368
Clean up the builder image
JohnnySheffield cbf08a7
wip buildable centos docker file
JohnnySheffield 57ee2b1
fixes port number
JohnnySheffield 3d9a07d
installing deps in on RUN command, adding comments
JohnnySheffield caeeeb0
cleaning after installation
JohnnySheffield 6298ef3
add -p to mkdir
JohnnySheffield 05f1de4
removing systemd is a no-no
JohnnySheffield 213fe9a
cleanup
JohnnySheffield 42c9a50
fix entrypooint
JohnnySheffield e33141a
formatting and cleaning
Dec- f9a945c
free up space taken by orphaned data from disabled or removed repos
JohnnySheffield c9a43df
reworking image to pull parity from git
JohnnySheffield a158dd0
pulling parity from git, new BUILD_REPO argument to allow for differe…
JohnnySheffield ce96e3c
fix
JohnnySheffield 43785e3
fix
JohnnySheffield ae26991
align rust installation
JohnnySheffield e7dcd01
set env
JohnnySheffield bb93d79
cleanup
JohnnySheffield 4ea5baa
cleanup
JohnnySheffield 8592fcf
builder pattern - splitting up the problem on two docker files and a …
JohnnySheffield 14c7082
Expose all default ports that could be used by Parity, set non-root u…
JohnnySheffield 5205220
Rename builder image ARG and ENV variables to more distinct name
JohnnySheffield 4e6ceea
Allow script configuration with env variables, add some echoes for a …
JohnnySheffield 63b3da2
Using ADD instead of git clone
JohnnySheffield 1b8820d
Echo commit hash that is being used for building, print out Parity ve…
JohnnySheffield 3a46d7f
add echo for parity version
JohnnySheffield d4330ce
add context
JohnnySheffield 1d486cb
append git sha to the builder image, update readme
JohnnySheffield c6a7ab2
optimising build context to include only what is necessary
JohnnySheffield 671a1de
update shebang
JohnnySheffield 09ee1a0
Remove empty continuation lines as they will become errors in a futur…
JohnnySheffield a4c93e0
Clean up the builder image
JohnnySheffield efe3e45
Merge branch 'docker-centos' of github.com:JohnnySheffield/parity-eth…
JohnnySheffield File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
echo Echoing Parity version: | ||
docker run $PARITY_IMAGE_REPO:$PARITY_RUNNER_IMAGE_TAG --version | ||
|
||
echo Done. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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")
There was a problem hiding this comment.
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