# ============================================================================= # Databricks Container Services — minimal base image for client.6.x # # This Python-focused reference builds the essential Python environment used by # the v6-standard image. It does not include the JDK or other non-Python runtime # components. Add customer-specific packages only at the marked points. # ============================================================================= FROM ubuntu:24.04 # Override this at build time when your organization uses a private PyPI mirror. ARG PIP_INDEX_URL=https://pypi.org/simple # Work around the Ubuntu 24.04 FIPS detection bug (LP#2066990). ENV OPENSSL_FORCE_FIPS_MODE=0 WORKDIR /databricks # Set the system timezone to UTC without persisting a runtime environment variable. RUN ln -snf /usr/share/zoneinfo/Etc/UTC /etc/localtime \ && echo "Etc/UTC" > /etc/timezone # Keep the Linux package set aligned with the v6 client-image sources instead # of pruning individual libraries based on assumed customer usage. RUN apt-get update \ && apt-get install -y \ apt-transport-https \ build-essential \ ca-certificates \ cmake \ curl \ file \ git \ iproute2 \ iputils-ping \ jq \ libbz2-dev \ libffi8 \ libffi-dev \ liblzma-dev \ libpq-dev \ libsqlite3-0 \ libsqlite3-dev \ libssl3t64 \ libssl-dev \ libtinfo6 \ locales \ procps \ psmisc \ python-is-python3 \ python3.12 \ python3.12-dev \ sudo \ unzip \ wget \ zstd \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # === ADD YOUR CUSTOM SYSTEM PACKAGES HERE === # Example: RUN apt-get update && apt-get install -y your-package && apt-get clean RUN locale-gen en_US.UTF-8 \ && update-locale LC_ALL=en_US.UTF-8 LANGUAGE=en_US.UTF-8 ENV LANG=en_US.UTF-8 # Databricks runs cluster-scoped library installations as this low-privilege user. RUN useradd libraries # Install uv system-wide using Astral's standalone installer. RUN curl -LsSf https://astral.sh/uv/0.11.16/install.sh \ | env UV_INSTALL_DIR=/usr/local/bin sh # Seed a shared uv cache so the platform can create child virtual environments # offline with the expected pip version. RUN mkdir -p /opt/uv-cache \ && uv --cache-dir /opt/uv-cache venv /tmp/uv-seed-venv \ && UV_DEFAULT_INDEX="${PIP_INDEX_URL}" uv pip install --cache-dir /opt/uv-cache \ --python /tmp/uv-seed-venv pip==25.3 \ && rm -rf /tmp/uv-seed-venv # Databricks requires the root virtual environment at this exact path. RUN UV_DEFAULT_INDEX="${PIP_INDEX_URL}" uv venv --python=/usr/bin/python3.12 \ --system-site-packages --seed --offline --cache-dir /opt/uv-cache \ /databricks/python3 RUN mkdir -p /databricks/.virtualenv-def COPY pyproject.toml /databricks/.virtualenv-def/pyproject.toml RUN UV_DEFAULT_INDEX="${PIP_INDEX_URL}" uv pip install --no-cache \ --python /databricks/python3/bin/python \ --requirement /databricks/.virtualenv-def/pyproject.toml # === ADD YOUR CUSTOM PYTHON PACKAGES HERE === # Example: RUN uv pip install --python /databricks/python3/bin/python your-package # Register the PySpark and Delta libraries bundled with Databricks Connect in # Python package metadata. Keep this after all Python package installations. RUN /databricks/python3/bin/_databricks-connect-register-pyspark-installation # --------------------------------------------------------------------------- # Environment setup (required by Databricks platform — do not modify) # --------------------------------------------------------------------------- # The following files and symlink are required by Databricks. RUN echo "client.6.x-base" > /databricks/IMAGE_KEY \ && echo "client.6.2" > /databricks/DBR_VERSION \ && ln -sfn /databricks/python3 /databricks/python # /etc/environment is read by Databricks when the container starts. # These variables are required by the platform; do not modify or remove them. RUN printf '%s\n' \ 'CLUSTER_DB_HOME=/databricks' \ 'DATABRICKS_RUNTIME_VERSION=client.6.2' \ 'DB_HOME=/databricks' \ 'DEFAULT_DATABRICKS_ROOT_VIRTUALENV_ENV=/databricks/python3' \ 'IS_CLIENT_IMAGE=true' \ 'MLFLOW_DEPLOYMENTS_TARGET=databricks' \ 'MLFLOW_GATEWAY_URI=databricks' \ 'MLFLOW_PYTHON_EXECUTABLE=/databricks/python/bin/python' \ 'MLFLOW_TRACKING_URI=databricks' \ 'OPENSSL_FORCE_FIPS_MODE=0' \ > /etc/environment # === ADD YOUR CUSTOM ENV VARS HERE === # Example: RUN echo 'MY_VAR=my_value' >> /etc/environment