1616#
1717# WARNING: THIS DOCKERFILE IS NOT INTENDED FOR PRODUCTION USE OR DEPLOYMENT.
1818#
19- ARG PYTHON_BASE_IMAGE="python:3.10 -slim-bookworm "
19+ ARG BASE_IMAGE="debian:bookworm -slim"
2020
2121##############################################################################################
2222# This is the script image where we keep all inlined bash scripts needed in other segments
23- # We use PYTHON_BASE_IMAGE to make sure that the scripts are different for different platforms.
23+ # We use BASE_IMAGE to make sure that the scripts are different for different platforms.
2424##############################################################################################
25- FROM ${PYTHON_BASE_IMAGE } as scripts
25+ FROM ${BASE_IMAGE } as scripts
2626
2727##############################################################################################
2828# Please DO NOT modify the inlined scripts manually. The content of those files will be
@@ -31,22 +31,27 @@ FROM ${PYTHON_BASE_IMAGE} as scripts
3131# make the PROD Dockerfile standalone
3232##############################################################################################
3333
34- # The content below is automatically copied from scripts/docker/install_os_dependencies .sh
35- COPY <<"EOF" /install_os_dependencies .sh
34+ # The content below is automatically copied from scripts/docker/install_os_dependencies_ci .sh
35+ COPY <<"EOF" /install_os_dependencies_ci .sh
3636#!/usr/bin/env bash
3737set -euo pipefail
3838
3939if [[ "$#" != 1 ]]; then
40- echo "ERROR! There should be 'runtime' or 'dev' parameter passed as argument.".
40+ echo "ERROR! There should be 'runtime', 'ci' or 'dev' parameter passed as argument.".
4141 exit 1
4242fi
4343
44+ AIRFLOW_PYTHON_VERSION=${AIRFLOW_PYTHON_VERSION:-v3.10.10}
45+ GOLANG_MAJOR_MINOR_VERSION=${GOLANG_MAJOR_MINOR_VERSION:-1.24.4}
46+
4447if [[ "${1}" == "runtime" ]]; then
4548 INSTALLATION_TYPE="RUNTIME"
4649elif [[ "${1}" == "dev" ]]; then
47- INSTALLATION_TYPE="dev"
50+ INSTALLATION_TYPE="DEV"
51+ elif [[ "${1}" == "ci" ]]; then
52+ INSTALLATION_TYPE="CI"
4853else
49- echo "ERROR! Wrong argument. Passed ${1} and it should be one of 'runtime' or 'dev'.".
54+ echo "ERROR! Wrong argument. Passed ${1} and it should be one of 'runtime', 'ci' or 'dev'.".
5055 exit 1
5156fi
5257
@@ -56,7 +61,10 @@ function get_dev_apt_deps() {
5661freetds-bin freetds-dev git graphviz graphviz-dev krb5-user ldap-utils libev4 libev-dev libffi-dev libgeos-dev \
5762libkrb5-dev libldap2-dev libleveldb1d libleveldb-dev libsasl2-2 libsasl2-dev libsasl2-modules \
5863libssl-dev libxmlsec1 libxmlsec1-dev locales lsb-release openssh-client pkgconf sasl2-bin \
59- software-properties-common sqlite3 sudo unixodbc unixodbc-dev zlib1g-dev"
64+ software-properties-common sqlite3 sudo unixodbc unixodbc-dev zlib1g-dev \
65+ gdb lcov pkg-config libbz2-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
66+ libncurses5-dev libreadline6-dev libsqlite3-dev lzma lzma-dev tk-dev uuid-dev \
67+ libzstd-dev"
6068 export DEV_APT_DEPS
6169 fi
6270}
@@ -143,14 +151,36 @@ function install_debian_runtime_dependencies() {
143151 rm -rf /var/lib/apt/lists/* /var/log/*
144152}
145153
154+ function install_python() {
155+ git clone --branch "${AIRFLOW_PYTHON_VERSION}" --depth 1 https://github.com/python/cpython.git
156+ cd cpython
157+ ./configure --enable-optimizations
158+ make -s -j "$(nproc)" all
159+ make -s -j "$(nproc)" install
160+ ln -s /usr/local/bin/python3 /usr/local/bin/python
161+ ln -s /usr/local/bin/pip3 /usr/local/bin/pip
162+ cd ..
163+ rm -rf cpython
164+ }
165+
166+ function install_golang() {
167+ curl "https://dl.google.com/go/go${GOLANG_MAJOR_MINOR_VERSION}.linux-$(dpkg --print-architecture).tar.gz" -o "go${GOLANG_MAJOR_MINOR_VERSION}.linux.tar.gz"
168+ rm -rf /usr/local/go && tar -C /usr/local -xzf go"${GOLANG_MAJOR_MINOR_VERSION}".linux.tar.gz
169+ }
170+
146171if [[ "${INSTALLATION_TYPE}" == "RUNTIME" ]]; then
147172 get_runtime_apt_deps
148173 install_debian_runtime_dependencies
149174 install_docker_cli
150175
151176else
177+
152178 get_dev_apt_deps
153179 install_debian_dev_dependencies
180+ install_python
181+ if [[ "${INSTALLATION_TYPE}" == "CI" ]]; then
182+ install_golang
183+ fi
154184 install_docker_cli
155185fi
156186EOF
@@ -939,7 +969,7 @@ function environment_initialization() {
939969 CI=${CI:="false"}
940970
941971 # Added to have run-tests on path
942- export PATH=${PATH}:${AIRFLOW_SOURCES}
972+ export PATH=${PATH}:${AIRFLOW_SOURCES}:/usr/local/go/bin/
943973
944974 mkdir -pv "${AIRFLOW_HOME}/logs/"
945975
@@ -1257,13 +1287,13 @@ COPY <<"EOF" /entrypoint_exec.sh
12571287exec /bin/bash "${@}"
12581288EOF
12591289
1260- FROM ${PYTHON_BASE_IMAGE } as main
1290+ FROM ${BASE_IMAGE } as main
12611291
12621292# Nolog bash flag is currently ignored - but you can replace it with other flags (for example
12631293# xtrace - to show commands executed)
12641294SHELL ["/bin/bash", "-o", "pipefail", "-o", "errexit", "-o", "nounset", "-o", "nolog", "-c"]
12651295
1266- ARG PYTHON_BASE_IMAGE
1296+ ARG BASE_IMAGE
12671297ARG AIRFLOW_IMAGE_REPOSITORY="https://github.com/apache/airflow"
12681298
12691299# By increasing this number we can do force build of all dependencies.
@@ -1273,7 +1303,7 @@ ARG AIRFLOW_IMAGE_REPOSITORY="https://github.com/apache/airflow"
12731303ARG DEPENDENCIES_EPOCH_NUMBER="15"
12741304
12751305# Make sure noninteractive debian install is used and language variables set
1276- ENV PYTHON_BASE_IMAGE =${PYTHON_BASE_IMAGE } \
1306+ ENV BASE_IMAGE =${BASE_IMAGE } \
12771307 DEBIAN_FRONTEND=noninteractive LANGUAGE=C.UTF-8 LANG=C.UTF-8 LC_ALL=C.UTF-8 \
12781308 LC_CTYPE=C.UTF-8 LC_MESSAGES=C.UTF-8 \
12791309 DEPENDENCIES_EPOCH_NUMBER=${DEPENDENCIES_EPOCH_NUMBER} \
@@ -1284,7 +1314,7 @@ ENV PYTHON_BASE_IMAGE=${PYTHON_BASE_IMAGE} \
12841314 UV_CACHE_DIR=/root/.cache/uv
12851315
12861316
1287- RUN echo "Base image version: ${PYTHON_BASE_IMAGE }"
1317+ RUN echo "Base image version: ${BASE_IMAGE }"
12881318
12891319ARG DEV_APT_COMMAND=""
12901320ARG ADDITIONAL_DEV_APT_COMMAND=""
@@ -1299,8 +1329,13 @@ ENV DEV_APT_COMMAND=${DEV_APT_COMMAND} \
12991329 ADDITIONAL_DEV_APT_DEPS=${ADDITIONAL_DEV_APT_DEPS} \
13001330 ADDITIONAL_DEV_APT_COMMAND=${ADDITIONAL_DEV_APT_COMMAND}
13011331
1302- COPY --from=scripts install_os_dependencies.sh /scripts/docker/
1303- RUN bash /scripts/docker/install_os_dependencies.sh dev
1332+ ARG AIRFLOW_PYTHON_VERSION=v3.10.18
1333+ ENV AIRFLOW_PYTHON_VERSION=$AIRFLOW_PYTHON_VERSION
1334+ ENV GOLANG_MAJOR_MINOR_VERSION=1.24.4
1335+
1336+ COPY --from=scripts install_os_dependencies_ci.sh /scripts/docker/
1337+
1338+ RUN bash /scripts/docker/install_os_dependencies_ci.sh ci
13041339
13051340COPY --from=scripts common.sh /scripts/docker/
13061341
0 commit comments