-
Notifications
You must be signed in to change notification settings - Fork 35
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
build(docker): add Dockerfile and container image build tests #362
Conversation
This change adds a Dockerfile for pycytominer along with associated checks and tests to ensure the image is prepared for use on distribution platforms like Docker Hub.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #362 +/- ##
=======================================
Coverage 94.96% 94.96%
=======================================
Files 56 56
Lines 3136 3136
=======================================
Hits 2978 2978
Misses 158 158
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Will get around to reviewing this in detail tomorrow. My main suggestions will be focused on seeing if we can find a way to avoid including the entire git history of our repo in the image. I think there's a path forward using |
@kenibrewer - let us know if you're able to give this a look. Thanks! (it is beyond my skill set) |
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.
Sorry for the delay in the review @d33bs . Have had some major projects going on at work. Here is some feedback focused primarily on reducing bloat within the docker image which I expect to be quite unwieldy in the current approach.
I tiered my recommendations based on the potential impact and complexity of implementation,
Strongly recommended fixes
- Do not use poetry virtual environments in the docker image and instead install dependencies directly into base python.
- Do not install docs dependency group within docker image.
Recommended fixes
- Avoid copying the entire git history of pycytominer into the image, potentially by implementing the feature in FeatureRequest: Add build artifacts for CI/CD pipeline #369 .
Discretionary fixes
- Remove dev dependencies from final build image using a multi-stage build.
Here's a pseudo dockerfile for the last item:
FROM python:latest AS build
COPY pycytominer requirements.txt ./
RUN pip install requirements.txt
FROM build as test
COPY tests requirements-dev.txt ./
RUN pip install requirements-dev.txt
Then use this https://docs.docker.com/build/building/multi-stage/#stop-at-a-specific-build-stage to tag one image as pycytominer-test and other other as pycytominer. Run pytest in the test image and then push the build image to dockerhub.
Co-Authored-By: Ken Brewer <[email protected]>
I've added some updates here based on your suggestions @kenibrewer, thanks a bunch for your assistance with the adjacent work in #373! I believe current test failures with the Docker image test revolve around those which I plan to address as part of the changed s3 data locations mentioned in #374 . I'm working on resolving the data issues in #374 before running a full test workflow check here. |
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.
Looks great! A few minor suggestions for adding clarity to the github actions at your discretion.
Looks like the extract should probably target '--directory.' Or maybe we just create the pycytominer directory first |
Co-Authored-By: Ken Brewer <[email protected]>
Thanks again @kenibrewer for your review and continued comments! I feel good about where things now stand and will merge this in now. |
Description
This change adds a Dockerfile for pycytominer along with associated checks and tests to ensure the image is prepared for use on distribution platforms like Docker Hub.
A first step towards addressing #214 .
What is the nature of your change?
Checklist
Please ensure that all boxes are checked before indicating that a pull request is ready for review.