@@ -15,11 +15,20 @@ USER 0
1515COPY --chown=1001:0 . .
1616RUN set -eux; \
1717 python -m pip install --no-cache-dir build; \
18+ cp pyproject.release.toml pyproject.toml; \
19+ python -m build --wheel --outdir /tmp/dist libs/tracing; \
20+ python -m build --wheel --outdir /tmp/dist libs/skinny; \
1821 python -m build --wheel --outdir /tmp/dist; \
1922 python -m build --wheel --outdir /tmp/dist kubernetes-workspace-provider
2023
2124FROM registry.access.redhat.com/ubi9/python-311@sha256:bb09d55bce99b839b0df565ab9e244cdc545037e612dad388569016137367cab
22- ARG MLFLOW_VERSION=3.3.2
25+ # Build cryptography from source against the system OpenSSL for FIPS compliance.
26+ # The pip manylinux wheel bundles its own non-FIPS OpenSSL, so we must compile
27+ # from source with OPENSSL_NO_VENDOR=1 to link against the system library.
28+ RUN set -eux; \
29+ dnf install -y --setopt=tsflags=nodocs openssl-devel cargo rust gcc python3.11-devel && \
30+ OPENSSL_NO_VENDOR=1 python -m pip wheel --no-cache-dir --no-binary cryptography "cryptography>=43.0.0,<47" -w /tmp/dist && \
31+ dnf clean all
2332ENV PYTHONDONTWRITEBYTECODE=1 \
2433 PYTHONUNBUFFERED=1 \
2534 MLFLOW_DISABLE_TELEMETRY=true \
@@ -29,14 +38,27 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
2938WORKDIR /app
3039
3140USER 0
32- COPY --from=python-builder /tmp/dist/mlflow-*.whl /tmp/dist/
33- COPY --from=python-builder /tmp/dist/mlflow_kubernetes_workspace_provider-*.whl /tmp/dist/
41+ COPY --from=python-builder /tmp/dist/ /tmp/dist/
3442RUN set -eux; \
35- dnf install -y --setopt=tsflags=nodocs postgresql-devel gcc python3-devel && \
36- python -m pip install --no-cache-dir /tmp/dist/mlflow-*.whl /tmp/dist/mlflow_kubernetes_workspace_provider-*.whl && \
43+ dnf install -y --setopt=tsflags=nodocs postgresql-devel gcc python3.11-devel && \
44+ python -m pip install --no-cache-dir /tmp/dist/mlflow*.whl && \
45+ python -m pip install --no-cache-dir --force-reinstall /tmp/dist/cryptography-*.whl && \
3746 python -m pip install --no-cache-dir boto3 psycopg2 prometheus-flask-exporter && \
3847 dnf clean all && \
39- rm -f /tmp/dist/mlflow-*.whl /tmp/dist/mlflow_kubernetes_workspace_provider-*.whl
48+ rm -rf /tmp/dist
49+
50+ # FIPS compliance: verify the cryptography package uses the system OpenSSL
51+ # rather than a bundled copy. The system OpenSSL on UBI 9 is FIPS-validated
52+ # and will operate in FIPS mode when the host kernel has FIPS enabled.
53+ RUN set -eux; \
54+ sys_openssl=$(openssl version | awk '{print $1, $2, $3, $4, $5}'); \
55+ py_openssl=$(python -c "from cryptography.hazmat.backends.openssl.backend import backend; print(backend.openssl_version_text())"); \
56+ echo "System OpenSSL: ${sys_openssl}"; \
57+ echo "cryptography OpenSSL: ${py_openssl}"; \
58+ [ "${sys_openssl}" = "${py_openssl}" ] || { \
59+ echo "FIPS ERROR: cryptography is not using the system OpenSSL"; \
60+ exit 1; \
61+ }
4062
4163# Copy built UI from builder stage
4264COPY --from=ui-builder /opt/app-root/src/build /tmp/mlflow-ui-build
0 commit comments