forked from apache/airflow
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to 'buildkit' to build Airflow images (apache#20664)
The "buildkit" is much more modern docker build mechanism and supports multiarchitecture builds which makes it suitable for our future ARM support, it also has nicer UI and much more sophisticated caching mechanisms as well as supports better multi-segment builds. BuildKit has been promoted to official for quite a while and it is rather stable now. Also we can now install BuildKit Plugin to docker that add capabilities of building and managin cache using dedicated builders (previously BuildKit cache was managed using rather complex external tools). This gives us an opportunity to vastly simplify our build scripts, because it has now much more robust caching mechanism than the old docker build (which forced us to pull images before using them as cache). We had a lot of complexity involved in efficient caching but with BuildKit all that can be vastly simplified and we can get rid of: * keeping base python images in our registry * keeping build segments for prod image in our registry * keeping manifest images in our registry * deciding when to pull or pull&build image (not needed now, we can always build image with --cache-from and buildkit will pull cached layers as needed * building the image when performing pre-commit (rather than that we simply encourage users to rebuild the image via breeze command) * pulling the images before building * separate 'build' cache kept in our registry (not needed any more as buildkit allows to keep cache for all segments of multi-segmented build in a single cache * the nice animated tty UI of buildkit eliminates the need of manual spinner * and a number of other complexities. Depends on apache#20238
- Loading branch information
Showing
42 changed files
with
387 additions
and
1,007 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ | |
# all the build essentials. This makes the image | ||
# much smaller. | ||
# | ||
# Use the same builder frontend version for everyone | ||
# syntax=docker/dockerfile:1.3 | ||
ARG AIRFLOW_VERSION="2.2.2" | ||
ARG AIRFLOW_EXTRAS="amazon,async,celery,cncf.kubernetes,dask,docker,elasticsearch,ftp,google,google_auth,grpc,hashicorp,http,ldap,microsoft.azure,mysql,odbc,pandas,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv" | ||
ARG ADDITIONAL_AIRFLOW_EXTRAS="" | ||
|
@@ -327,34 +329,6 @@ RUN if [[ -f /docker-context-files/requirements.txt ]]; then \ | |
pip install --no-cache-dir --user -r /docker-context-files/requirements.txt; \ | ||
fi | ||
|
||
ARG BUILD_ID | ||
ARG COMMIT_SHA | ||
ARG AIRFLOW_IMAGE_REPOSITORY | ||
ARG AIRFLOW_IMAGE_DATE_CREATED | ||
|
||
ENV BUILD_ID=${BUILD_ID} COMMIT_SHA=${COMMIT_SHA} | ||
|
||
LABEL org.apache.airflow.distro="debian" \ | ||
org.apache.airflow.distro.version="buster" \ | ||
org.apache.airflow.module="airflow" \ | ||
org.apache.airflow.component="airflow" \ | ||
org.apache.airflow.image="airflow-build-image" \ | ||
org.apache.airflow.version="${AIRFLOW_VERSION}" \ | ||
org.apache.airflow.build-image.build-id=${BUILD_ID} \ | ||
org.apache.airflow.build-image.commit-sha=${COMMIT_SHA} \ | ||
org.opencontainers.image.source=${AIRFLOW_IMAGE_REPOSITORY} \ | ||
org.opencontainers.image.created=${AIRFLOW_IMAGE_DATE_CREATED} \ | ||
org.opencontainers.image.authors="[email protected]" \ | ||
org.opencontainers.image.url="https://airflow.apache.org" \ | ||
org.opencontainers.image.documentation="https://airflow.apache.org/docs/docker-stack/index.html" \ | ||
org.opencontainers.image.version="${AIRFLOW_VERSION}" \ | ||
org.opencontainers.image.revision="${COMMIT_SHA}" \ | ||
org.opencontainers.image.vendor="Apache Software Foundation" \ | ||
org.opencontainers.image.licenses="Apache-2.0" \ | ||
org.opencontainers.image.ref.name="airflow-build-image" \ | ||
org.opencontainers.image.title="Build Image Segment for Production Airflow Image" \ | ||
org.opencontainers.image.description="Reference build-time dependencies image for production-ready Apache Airflow image" | ||
|
||
############################################################################################## | ||
# This is the actual Airflow image - much smaller than the build one. We copy | ||
# installed Airflow and all it's dependencies from the build image to make it smaller. | ||
|
Oops, something went wrong.