Skip to content
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

feat: adding slim dockerfile #2219

Merged
merged 47 commits into from
Aug 19, 2024

Conversation

johnson2427
Copy link
Contributor

@johnson2427 johnson2427 commented Aug 13, 2024

What I did

Created Dockerfile.slim for a slim version of ape without recommended-plugins

fixes: #2143

How I did it

Needed to create the whl files with python:3.11, then switch to python:3.11-slim after the whl files are created. This install ends up being 500MB in size vs 2.24GB in the current Dockerfile build.

I then install the recommended plugins in the Dockerfile for the latest version. The size of the image reduced from 2.24GB to 571MB.

How to verify it

git checkout feat/create-bare-ape-image
docker build -t ape:latest-slim -f Dockerfile.slim .
docker image ls
...
...      ...               ...   SIZE
ape   latest-slim                500MB
ape   latest                     571MB

Checklist

  • All changes are completed
  • New test cases have been added
  • Documentation has been updated

antazoey
antazoey previously approved these changes Aug 13, 2024
Copy link
Member

@antazoey antazoey left a comment

Choose a reason for hiding this comment

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

One question, with an idea for potential improvement, but otherwise LGTM

Dockerfile.slim Outdated Show resolved Hide resolved
@johnson2427
Copy link
Contributor Author

@fubuloubu make sure this works the way it did before. I checked the pip list, and for some reason this is installing eth-ape in two places, so I'm still trying to figure that out.

Dockerfile.slim Outdated Show resolved Hide resolved
Copy link
Member

@fubuloubu fubuloubu left a comment

Choose a reason for hiding this comment

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

Keep coming back to our github-action and wondering if there is a good way to make the recommended-plugins image work with the action to speed that up

Sorry about all the comments, didn't realize just how out of date the old dockerfile was

.github/workflows/build.yaml Outdated Show resolved Hide resolved
.github/workflows/build.yaml Outdated Show resolved Hide resolved
.github/workflows/build.yaml Show resolved Hide resolved
.github/workflows/build.yaml Show resolved Hide resolved
.github/workflows/build.yaml Outdated Show resolved Hide resolved
Dockerfile.slim Outdated Show resolved Hide resolved
Dockerfile.slim Show resolved Hide resolved
Dockerfile.slim Outdated Show resolved Hide resolved
Dockerfile.slim Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
.github/workflows/build.yaml Show resolved Hide resolved
.github/workflows/build.yaml Show resolved Hide resolved
.github/workflows/build.yaml Show resolved Hide resolved
@johnson2427
Copy link
Contributor Author

This is what we end up with

            "build-arg:BUILD_DATE": "2024-08-16T18:48:15Z",
            "build-arg:VCS_REF": "c3eada713fcf78b7fba8d82571298869883ffb14",
            "build-arg:VERSION": "",
            "label:org.opencontainers.image.created": "2024-08-16T19:13:35.036Z",
            "label:org.opencontainers.image.description": "The smart contract development tool for Pythonistas, Data Scientists, and Security Professionals",
            "label:org.opencontainers.image.licenses": "Apache-2.0",
            "label:org.opencontainers.image.revision": "c3eada713fcf78b7fba8d82571298869883ffb14",
            "label:org.opencontainers.image.source": "https://github.com/ApeWorX/ape",
            "label:org.opencontainers.image.title": "ape",
            "label:org.opencontainers.image.url": "https://github.com/ApeWorX/ape",
            "label:org.opencontainers.image.version": "pr-2219"

@johnson2427
Copy link
Contributor Author

I need to fix the documentation for the Intalling with 'docker' section, but I'm having a hard time doing so without publishing the images. I think we should update docs in a separate PR, but I'll leave that up to you two

@fubuloubu
Copy link
Member

I need to fix the documentation for the Intalling with 'docker' section, but I'm having a hard time doing so without publishing the images. I think we should update docs in a separate PR, but I'll leave that up to you two

How do you think it will be different?

@johnson2427
Copy link
Contributor Author

I need to fix the documentation for the Intalling with 'docker' section, but I'm having a hard time doing so without publishing the images. I think we should update docs in a separate PR, but I'll leave that up to you two

How do you think it will be different?

We are no longer going to be pushing to dockerhub from what I remember in our conversation from earlier this week. I'd like to give the ghcr location for users.

@fubuloubu
Copy link
Member

I need to fix the documentation for the Intalling with 'docker' section, but I'm having a hard time doing so without publishing the images. I think we should update docs in a separate PR, but I'll leave that up to you two

How do you think it will be different?

We are no longer going to be pushing to dockerhub from what I remember in our conversation from earlier this week. I'd like to give the ghcr location for users.

Ah yes, for sure. I think what we can do with this PR is stop publishing to dockerhub and start publishing to ghcr, and then update the instructions before we create a release containing this update. Once merged, I will stop automated publishing on dockerhub, and we should also port some of the older images to ghcr as well to ensure continuity for any users, and then make a public announcement for that as well

@johnson2427
Copy link
Contributor Author

Currently, from the automated metadata creation, this is where our image will go ghcr.io/apeworx/ape. I believe you want this to go to ghcr.io/apeframework/ape, correct @fubuloubu?

@fubuloubu
Copy link
Member

Currently, from the automated metadata creation, this is where our image will go ghcr.io/apeworx/ape. I believe you want this to go to ghcr.io/apeframework/ape, correct @fubuloubu?

No! That place is good, wanted it @ ghcr.io/apeworx/ape

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Member

@fubuloubu fubuloubu left a comment

Choose a reason for hiding this comment

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

If you feel confident in the workflow, it is ready to go. Would recommend just doing some local testing with a repo under your personal if you've not sure

@johnson2427 johnson2427 merged commit 7dd9d4c into ApeWorX:main Aug 19, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: create a bare ape image
3 participants