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

Use 'git clone --depth 1' to reduce docker image size from 1GB to 500MB #830

Merged
merged 1 commit into from
May 20, 2022

Conversation

Sieboldianus
Copy link
Contributor

@Sieboldianus Sieboldianus commented Apr 17, 2022

I am not sure if there is a specific reason to clone the full repository inside Dockerfile.

If not, with git clone --depth 1, the docker image size can be reduced from 1000MB to 500MB.

This will create a shallow clone, which is primarily useful for builds, not development.

@jaedb
Copy link
Owner

jaedb commented May 8, 2022

It is a workaround for users who want to run a development build, the whole idea of including the repo needs rehinking. Thanks for your contribution - it'll be a great additional until I can solve this more cleanly.

@jaedb jaedb changed the base branch from master to develop May 20, 2022 07:38
@jaedb jaedb merged commit 9bd5ba0 into jaedb:develop May 20, 2022
@Sieboldianus Sieboldianus deleted the reduce-docker-size branch May 22, 2022 05:39
@djmattyg007
Copy link
Contributor

Perhaps the solution is to have two different docker images?

@Sieboldianus
Copy link
Contributor Author

Or, a different tag - e.g. iris:latest, iris:develop

@Sieboldianus
Copy link
Contributor Author

Perhaps the solution is to have two different docker images?

@jaedb @djmattyg007

I thought about this - there are Multistage Docker builds. Perhaps this could be an option to reduce the image size further in future releases, and also provide an additional developer image. I have recently added a Multistage Dockerimage for asciiflow, have a look at the Dockerfile here, which includes multiple FROM tags. The final alpine nginx image is 19 MB.

Just thinking..

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.

3 participants