Skip to content

Conversation

@JeffersonGibin
Copy link

@JeffersonGibin JeffersonGibin commented Nov 15, 2022

Docker image customization and minification

Hello everyone, I made some improvements to Dockerfile and docker-compose, I hope it will be helpful in the community.

What was improved?

  • Reduction in final image size from 10.3GB to 7.19GB
  • Update nvidia/cuda image from 11.3.1-base-ubuntu20.04 to 11.8.0-base-ubuntu22.04
  • Customization of the execution of files from the optimizedSD directory
  • Update numpy from 1.19.2 to 1.20.3

How to use execution customization?

  • If you need to run another file from the OptimizedSD directory, is possible to modify the default execution, by changing the environment variable APP_MAIN_FILE in docker-compose.yml and doing a new build by running:
docker-compose up --build
  • If you don't want to use docker-compose, you can provide the OPTIMIZED_FILE argument with the following command.
docker build --tag newimage --build-arg OPTIMIZED_FILE=optimized_img2img.py .

What was not improved?

  • No modifications to the project's source.

Wrong: to ensure that the tests do not have side effects, please remove container and docker images related to the project.

Ideas to improve build time in the future

  • The venv could be uploaded to some storage and when building the image download the environment, this will probably be considerably faster than the build step.

  • Positive: The image does not need to go through several steps to build the environment (compression and decompression, downloading packages)

  • Negative: I would need to update venv whenever new dependencies are added to the project

@JeffersonGibin JeffersonGibin changed the title customization, reduction, and separation of the docker environment Docker image customization and minification Nov 16, 2022
@basujindal
Copy link
Owner

Hi Jefferson, thank you for the changes, it is very helpful!

@basujindal basujindal merged commit 54b4a91 into basujindal:main Nov 16, 2022
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.

2 participants