datalad/datalad-registry

Copying of `.git` into Dockerfile

Opened this issue · 5 comments

COPY .git .git

As illustrated above, currently, the .git directory is copied to the docker image of the project because versioningit, the versioning system, requires it to build the project. Look in to whether this can be circumvented or avoided.

This issue is related to #334 to some degree.

while doing full "source distribution" all needed version placeholders are provided somewhere, thus avoiding need for carrying .git around, right @jwodder ?

@yarikoptic If you're installing from an sdist (assuming that's what you're referring to), then versioningit doesn't need (or use) .git/.

yes, that is what I mean. so instead of all the manual individual COPY steps there should just be an sdist step in

COPY setup.cfg setup.cfg
with pip following installation from it, to make it all clean, right?

@yarikoptic

  • If you mean a step that copies an sdist into the Dockerfile, that would obviously require building the sdist outside of Docker. How would that be added to the current automation?

  • If you do get this to work, I think it'd be a better idea to use a wheel instead of an sdist, as a wheel is more "installation-ready."

@yarikoptic @jwodder Thanks for your inputs. In light of your ideas, I think we can approach this problem by using the multi-stage build feature in Docker/Podman. Essentially, using this feature, we can separate the build environment from the runtime environment and include only the runtime environment in the container image for the project.