yiga2 opened a new issue #18913:
URL: https://github.com/apache/airflow/issues/18913


   ### Description
   
   Here an alternative to the `Dockerfile`  @ 
https://github.com/apache/airflow/blob/main/docs/docker-stack/docker-images-recipes/gcloud.Dockerfile
 that produces a much smaller image with `gcloud sdk`.
   
   It has **_not_** been tested with all relevant operators but it meets our 
needs and possibly yours if you use `gcloud`, `gsutil`, `bq` and `kubectl` 
utils.    
   
   It leverages multi-layers, removes bin dupes for kubectl and removes anthos 
components. Also, no need to version the SDK, the latest will be used & copied.
   
   ```
   ARG VERSION
   
   FROM gcr.io/google.com/cloudsdktool/cloud-sdk:alpine as gcloud-image
   RUN gcloud components install alpha beta kubectl --quiet \
       && rm -rf \
           google-cloud-sdk/bin/anthoscli \
           google-cloud-sdk/bin/kubectl.* \
           $(find google-cloud-sdk/ -regex ".*/__pycache__") \
           google-cloud-sdk/.install/.backup
   
   FROM apache/airflow:${VERSION}
   ENV GCLOUD_HOME=/opt/google-cloud-sdk
   COPY --from=gcloud-image    /google-cloud-sdk   ${GCLOUD_HOME}
   ENV PATH="${GCLOUD_HOME}/bin/:${PATH}"
   
   USER ${AIRFLOW_UID}
   ```
   
   ### Use case/motivation
   
   Efficiency. 
   
   Building based on AF `2.1.4-python3.9, the compressed image size is 40% 
smaller than using the original recipe. 
   
   That's **327 MB** vs **567 MB** ... 
   
   Give it a try and let me know !
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to