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

DOCKER: Build wheel and install in two-stage build #2859

Merged
merged 5 commits into from
Sep 27, 2022

Conversation

effigies
Copy link
Member

Changes proposed in this pull request

This PR aims to make the Docker build less fragile by building the package wheel in an initial stage with full git information, and then copying only the wheel over to the main build.

Assuming that the COPY at L29 doesn't break the caching of everything afterwards, then we should be good. Otherwise we can switch to something like:

FROM ubuntu:... as base
...

FROM python:slim as wheel
...

FROM base
COPY --from=wheel ...
...

This will also allow us to stop using a custom versioneer.

.zenodo.json
.travis.yml
.readthedocs.yml
CONTRIBUTING.md
Copy link
Member Author

Choose a reason for hiding this comment

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

These things were removed to avoid getting a dirty repository. We now do not do a COPY . outside of the wheel building stage, so this should not pollute the image.

RUN apt-get update && \
apt-get install -y --no-install-recommends git
COPY . /src/fmriprep
RUN python -m build /src/fmriprep
Copy link
Member Author

Choose a reason for hiding this comment

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

I've tested locally. Modifying the repository will make this rerun but will not cause a cache miss on L33+ until there's another change in the Dockerfile or a COPY/ADD command fails a hash check.

@effigies effigies force-pushed the docker/wheel branch 2 times, most recently from 1352a77 to 918c856 Compare September 26, 2022 20:21
@effigies effigies self-assigned this Sep 27, 2022
Copy link
Collaborator

@mgxd mgxd left a comment

Choose a reason for hiding this comment

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

+1 on removing the versioneer hack

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
fmriprep/workflows/bold/outputs.py Show resolved Hide resolved
@effigies effigies merged commit 5af6241 into nipreps:master Sep 27, 2022
@effigies effigies deleted the docker/wheel branch September 27, 2022 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Released
Development

Successfully merging this pull request may close these issues.

None yet

2 participants