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

Copying of .git into Dockerfile #335

Open
candleindark opened this issue Mar 15, 2024 · 5 comments
Open

Copying of .git into Dockerfile #335

candleindark opened this issue Mar 15, 2024 · 5 comments

Comments

@candleindark
Copy link
Collaborator

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.

@yarikoptic
Copy link
Member

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

@jwodder
Copy link
Member

jwodder commented Mar 15, 2024

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

@yarikoptic
Copy link
Member

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?

@jwodder
Copy link
Member

jwodder commented Mar 15, 2024

@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."

@candleindark
Copy link
Collaborator Author

@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.

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

No branches or pull requests

3 participants