-
Notifications
You must be signed in to change notification settings - Fork 414
Fixed root Dockerfile for building vtr container #1970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed root Dockerfile for building vtr container #1970
Conversation
PTAL - @umarcor |
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.
We should add CI which makes sure that this Docker file continues to work?
Yes, I'll be wroking on it and I'm also intending to Update the related documentaton.. |
Dockerfile
Outdated
libtbb-dev \ | ||
python3-pip \ | ||
# Clone VTR repo | ||
&& git clone https://github.com/verilog-to-routing/vtr-verilog-to-routing.git . \ |
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.
Since this dockerfile is located in the root of the repo, users/developers do need to clone the repo already. Therefore, cloning it again inside the Dockerfile is redundant. I recommend to use BuildKit's mount
features instead. See https://hdl.github.io/containers/dev/Contributing.html#buildkit and https://github.com/hdl/containers/blob/main/debian-bullseye/boolector/Dockerfile#L27.
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.
Overall, it is not desirable to install the dependencies and build VTR in the same docker build
execution. That is particularly relevant if the dockerfile is to be used locally, to work around environment (host OS) limitations.
Instead, I'd suggest to use named stages and split dependency installation from building the tool (VTR here). That will allow to build the image with dependencies in CI and make it available through a registry. Then, users will only need to pull the image and build VTR, without installing all the deps again and again.
You can still use a single Dockerfile, but you need to use named stages.
Nonetheless, this is not specific to this PR, because the previous Dockerfile was already written like that. Hence, it can be addressed later.
@mithro building to ensure that the Dockerfile works is trivial: Image:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v2
- name: Build container image
run: docker build -t test/vtr -f Dockerfile . My recommendation would be to use ghcr, because it works with the default token. So: Image:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v2
- name: Build container image
run: docker build -t ghcr.io/verilog-to-routing/build -f Dockerfile .
- name: Push container image
uses: pyTooling/Actions/with-post-step@r0
with:
main: |
echo '${{ github.token }}' | docker login ghcr.io -u GitHub-Actions --password-stdin
docker push ghcr.io/verilog-to-routing/build
post: docker logout ghcr.io On the other hand, there is https://github.com/hdl/containers/blob/main/debian-bullseye/vtr.dockerfile#L24-L43 already. |
@umarcor Thank you for your time and the detailed review. Most of your comments have been implemented. Currently, I'm reading BuildKit's docs in order to utilize the mount feature. I'll re-open the PR after completing.
Yes, I agree with you. I just fixed the Dockerfile according to its current structure, since I was trying to build VTR on MAC and did not have native Linux support. I'll rewrite the Dockerfile and implement the structure you mentioned in a future PR (if someone doesn't accomplish it sooner). |
- The image is now based on Ubuntu 20:04 LTS - Derive build packages from install_apt_packages.sh & requirements.txt
aa8e622
to
7271f68
Compare
@umarcor I applied your reviews as much as I could; however, I could not apply following:
|
|
@mithro This PR is ready to merge, JFYI. |
Fixed broken Dockerfile script located at the project root.
Description
Related Issue
#1756
Motivation and Context
As an option for building VTR, there is a docker container build script. VTR's fixed Dockerfile allows it to be built on different OSs and architectures effortlessly, by just running one command. This can especially be useful for building VTR on devices with Apple Silicon processors which currently lack native Linux support but support Linux-based docker containers.
How Has This Been Tested?
The fixed Dockerfile script now builds VTR sucessfully.
Types of changes
Checklist: