Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Update Dockerfile #1359

Merged
merged 4 commits into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 11 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,20 @@ jobs:
environment:
TOXENV: py37-eth2-components

docker-image-build-test:
docker-trinity-image-build-test:
machine: true
steps:
- checkout
- run: docker build -t ethereum/trinity:test-build .
- run: docker build -t ethereum/trinity:test-build -f ./docker/Dockerfile .
- run: docker run ethereum/trinity:test-build --help

docker-trinity-beacon-image-build-test:
machine: true
steps:
- checkout
- run: docker build -t ethereum/trinity-beacon:test-build -f ./docker/beacon.Dockerfile .
- run: docker run ethereum/trinity-beacon:test-build --help

workflows:
version: 2
test:
Expand Down Expand Up @@ -434,4 +441,5 @@ workflows:
- py37-lint
- py37-lint-eth2

- docker-image-build-test
- docker-trinity-image-build-test
- docker-trinity-beacon-image-build-test
19 changes: 0 additions & 19 deletions Dockerfile.eth2

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ release: clean
git config commit.gpgSign "$(CURRENT_SIGN_SETTING)"

create-docker-image: clean
docker build -t ethereum/trinity:latest -t ethereum/trinity:$(version) .
docker build -t ethereum/trinity:latest -t ethereum/trinity:$(version) -f ./docker/Dockerfile ./docker

create-dappnode-image: clean
sed -i -e 's/ARG GITREF=\w*/ARG GITREF=$(trinity_version)/g' ./dappnode/build/Dockerfile
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions docker/beacon.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.7
# Set up code directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# Install deps
RUN apt-get update
RUN apt-get -y install libsnappy-dev gcc g++ cmake

RUN git clone https://github.com/ethereum/trinity.git .
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that this will build the master branch Trinity, instead of PR branch of Trinity. Not sure if this is what we want.

If we want to build the PR branch, we should use something like COPY . trinity

Copy link
Contributor Author

@hwwhww hwwhww Dec 5, 2019

Choose a reason for hiding this comment

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

I read some docker best practice articles earlier today. An argument is that git clone gives us some flexibility at the development stage, and COPY is more common in production.

I think at the development stage, using git clone makes it a more isolated environment, which is good in some way.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we want to build the PR branch, we should use something

That's an interesting point though. The Eth1 Dockerfile uses COPY and I actually wanted to change it to use git clone but your point makes me re-think that. We had a few times where the docker build exposed a general problem with Trinity (usually dependency issues) and as you say, if you use git clone then the CI run ends up always using the source from master which sounds like a weakness.

Another possible idea would be to pre-process the Dockerfile to replace the $GITREF like we do with the DappNode build.

trinity/Makefile

Lines 89 to 92 in 0e3e67d

create-dappnode-image: clean
sed -i -e 's/ARG GITREF=\w*/ARG GITREF=$(trinity_version)/g' ./dappnode/build/Dockerfile
cd ./dappnode && dappnodesdk increase $(dappnode_bump)
cd ./dappnode && dappnodesdk build

RUN pip install -e .[eth2-dev] --no-cache-dir
hwwhww marked this conversation as resolved.
Show resolved Hide resolved

RUN echo "Type \`trinity-beacon\` to boot or \`trinity-beacon --help\` for an overview of commands"

EXPOSE 30303 30303/udp
ENTRYPOINT ["trinity-beacon"]