Skip to content

Improve Dockerfile

Tan Le requested to merge tl-improve-dockerfile into main

What does this merge request do and why?

  • Use same base image to save bandwidth
  • Remove redundant wheel building step (tree-sitter is already built as part of poetry build)
  • Use non-interactive gcloud installation
  • Clean up lingering package cache to reduce size
  • Ensure dependencies complied with lock file

How to set up and validate locally

  1. Ensure GCP enviroment variables are setup.
  2. Check out to this merge request's branch.
  3. Run the follow command to build a new Docker container.
    docker build --target=client --no-cache --tag promptlib-client:0.2.0 .
  4. Ensure the Docker image is built successfully.
Before - 1.1 GB
Image name: /tmp/prompt-lib-0.1.tar                      
Total Image size: 1.1 GB                                 
Potential wasted space: 5.2 MB                           
Image efficiency score: 99 %                             
                                                         
Count   Total Space  Path                                
    3        2.3 MB  /var/cache/debconf/templates.dat    
    2        1.6 MB  /var/cache/debconf/templates.dat-old
    4        338 kB  /var/lib/dpkg/status                
    4        338 kB  /var/lib/dpkg/status-old            
    3        244 kB  /var/log/dpkg.log                   
    3         91 kB  /var/log/apt/term.log               
    2         84 kB  /var/lib/dpkg/info/perl-base.list   
    3         37 kB  /var/cache/debconf/config.dat       
    4         26 kB  /var/log/apt/eipp.log.xz            
    3         25 kB  /var/cache/debconf/config.dat-old   
    4         21 kB  /etc/ld.so.cache                    
    3         21 kB  /var/log/apt/history.log            
    4         20 kB  /var/lib/apt/extended_states        
    3         16 kB  /var/cache/ldconfig/aux-cache       
    2         423 B  /root/.wget-hsts                    
    2           0 B  /var/lib/dpkg/triggers/Unincorp     
    4           0 B  /var/lib/dpkg/triggers/Lock         
    4           0 B  /var/lib/dpkg/lock                  
    2           0 B  /etc                                
    2           0 B  /tmp                                
After - 927 MB
Image name: /tmp/prompt-lib-0.2.tar                      
Total Image size: 927 MB                                 
Potential wasted space: 5.2 MB                           
Image efficiency score: 99 %                             
                                                         
Count   Total Space  Path                                
    3        2.3 MB  /var/cache/debconf/templates.dat    
    2        1.6 MB  /var/cache/debconf/templates.dat-old
    4        338 kB  /var/lib/dpkg/status                
    4        338 kB  /var/lib/dpkg/status-old            
    3        244 kB  /var/log/dpkg.log                   
    3         91 kB  /var/log/apt/term.log               
    2         84 kB  /var/lib/dpkg/info/perl-base.list   
    3         37 kB  /var/cache/debconf/config.dat       
    4         26 kB  /var/log/apt/eipp.log.xz            
    3         25 kB  /var/cache/debconf/config.dat-old   
    4         21 kB  /etc/ld.so.cache                    
    3         21 kB  /var/log/apt/history.log            
    4         20 kB  /var/lib/apt/extended_states        
    3         16 kB  /var/cache/ldconfig/aux-cache       
    2         423 B  /root/.wget-hsts                    
    4           0 B  /var/lib/dpkg/triggers/Lock         
    2           0 B  /var/lib/dpkg/triggers/Unincorp     
    2           0 B  /tmp                                
    4           0 B  /var/lib/dpkg/lock                  

Merge request checklist

  • I've ran the affected pipeline(s) to validate that nothing is broken.
  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.
Edited by Tan Le

Merge request reports

Loading