Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cds_testrig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
repository: ${{ github.repository }}@${{ github.ref_name }}
config-file: cds_testrig_config.yaml
disable-codestyle-checks: true
python-version: "3.9"
python-version: "3.14"
skip-report: false
report-repository: ${{ github.repository }}
report-branch: gh-pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, 3.12]
python-version: ["3.14"]
db-service: [postgresql14]
search-service: [opensearch2]
include:
Expand Down
124 changes: 76 additions & 48 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
# Dockerfile that builds a fully functional image of your app.
#
# This image installs all Python dependencies for your application. It's based
# on Almalinux (https://github.com/inveniosoftware/docker-invenio)
# and includes Pip, Pipenv, Node.js, NPM and some few standard libraries
# Invenio usually needs.
# on the Invenio Debian image that ships Python 3.14, uv and Node.js
# (https://github.com/inveniosoftware/docker-invenio)
# and installs the few standard libraries Invenio usually needs.
#
# Note: It is important to keep the commands in this file in sync with your
# bootstrap script located in ./scripts/bootstrap.

FROM registry.cern.ch/inveniosoftware/almalinux:1

RUN dnf install -y epel-release
RUN dnf update -y

# XRootD
ARG xrootd_version="5.5.5"
# Repo required to find all the releases of XRootD
RUN dnf config-manager --add-repo https://cern.ch/xrootd/xrootd.repo
RUN if [ ! -z "$xrootd_version" ] ; then XROOTD_V="-$xrootd_version" ; else XROOTD_V="" ; fi && \
echo "Will install xrootd version: $XROOTD_V (latest if empty)" && \
dnf install -y xrootd"$XROOTD_V" python3-xrootd"$XROOTD_V"
# /XRootD

# OpenLDAP
RUN dnf install -y openldap-devel

# CRB (Code Ready Builder): equivalent repository to well-known CentOS PowerTools
RUN dnf install -y yum-utils
RUN dnf config-manager --set-enabled crb
# Volume where to mount the keytab as a secrets
# If credentials are passed as username and password with
# KEYTAB_USER and KEYTAB_PWD environment variables, a keytab will be
# generated and stored in KEYTAB_PATH.
RUN dnf install -y krb5-workstation krb5-libs krb5-devel
ARG BUILD_PLATFORM=linux/amd64
ARG PNPM_VERSION=10.33.2

# --- Build stage ---
FROM --platform=${BUILD_PLATFORM} registry.cern.ch/inveniosoftware/debian:3.14 AS builder

# System libraries:
# - libkrb5-dev / krb5-user: gssapi and requests-kerberos (build + Kerberos auth)
# - libcairo2 / libmagickwand-7.q16-10: cairocffi and wand open these through ctypes,
# so they are needed when the app is imported during `invenio collect/webpack`
# - XRootD needs nothing here, the PyPI wheel (xrootd extra) bundles its libraries
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \
krb5-user \
libcairo2 \
libgssapi-krb5-2 \
libkrb5-dev \
libmagickwand-7.q16-10 \
pkg-config
# Kerberos configuration (requests-kerberos / XRootD auth)
COPY ./krb5.conf /etc/krb5.conf

# Node.js 22 + pnpm (base image ships Node 16 from NodeSource, too old for pnpm 10)
RUN dnf remove -y nodejs npm && \
dnf module reset -y nodejs && \
dnf module enable -y nodejs:22 && \
dnf install -y nodejs npm
RUN npm install -g [email protected]
ARG PNPM_VERSION
RUN npm install --global pnpm@${PNPM_VERSION}
ENV PNPM_STORE_DIR=/opt/.cache/pnpm-store

# Sits above project-source COPYs so the layer only invalidates when the lockfile
Expand All @@ -54,31 +47,23 @@ RUN --mount=type=cache,target=/opt/.cache/pnpm-store \
pnpm install --frozen-lockfile --shamefully-hoist

# Python and uv configuration
# The base image ships Python 3.14; pin uv to it so it never picks another interpreter.
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
UV_PYTHON=3.14 \
UV_CACHE_DIR=/opt/.cache/uv \
UV_COMPILE_BYTECODE=1 \
UV_FROZEN=1 \
UV_LINK_MODE=copy \
UV_NO_MANAGED_PYTHON=1 \
UV_SYSTEM_PYTHON=1 \
# Tell uv to use system Python
UV_PROJECT_ENVIRONMENT=/usr/ \
UV_PYTHON_DOWNLOADS=never \
UV_REQUIRE_HASHES=1 \
UV_VERIFY_HASHES=1

# Get latest version of uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

# Install Python dependencies using uv
ARG BUILD_EXTRAS="--extra sentry --extra xrootd"
RUN --mount=type=cache,target=/opt/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --no-dev --no-install-workspace --no-editable $BUILD_EXTRAS \
# (py)xrootd is already installed above using dnf
--no-install-package=xrootd
uv sync --no-dev --no-install-workspace --no-editable $BUILD_EXTRAS

COPY site ./site

Expand All @@ -91,9 +76,7 @@ COPY ./ .

# Make sure workspace packages are installed (cds-rdm)
RUN --mount=type=cache,target=/opt/.cache/uv \
uv sync --frozen --no-dev $BUILD_EXTRAS \
# (py)xrootd is already installed above using dnf
--no-install-package=xrootd
uv sync --frozen --no-dev $BUILD_EXTRAS

# We're caching on a mount, so for any commands that run after this we
# don't want to use the cache (for image filesystem permission reasons)
Expand All @@ -113,4 +96,49 @@ RUN cd ${INVENIO_INSTANCE_PATH}/assets && pnpm run build

COPY ./ .

# node_modules and the webpack sources are only needed to build the bundle; the built
# files live in the instance's static folder.
RUN rm -rf ${INVENIO_INSTANCE_PATH}/assets

# --- Application image ---
# Must stay on the same Python and Debian release as the base image above, so that the
# venv and its compiled extensions still match.
FROM --platform=${BUILD_PLATFORM} python:3.14-slim-trixie

# Shared libraries the venv links against: libcairo2 and libmagickwand for cairocffi and
# wand (loaded through ctypes), the Kerberos ones for python-gssapi and
# requests-kerberos, libpcre2/libxml2/libuuid1 for uwsgi and lxml. procps provides
# ps/top/pkill for interactive shells in a running container.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \
ca-certificates \
krb5-user \
libcairo2 \
libgssapi-krb5-2 \
libmagickwand-7.q16-10 \
libpcre2-8-0 \
libuuid1 \
libxml2 \
procps

# Kerberos configuration (requests-kerberos / XRootD auth)
COPY ./krb5.conf /etc/krb5.conf

ENV WORKING_DIR=/opt/invenio \
INVENIO_INSTANCE_PATH=/opt/invenio/var/instance \
PATH=/opt/invenio/src/.venv/bin:${PATH} \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
UV_NO_CACHE=1

# The venv has no pip, so `uv pip list` is the way to inspect installed dependencies
# from inside a running container.
COPY --from=builder /usr/bin/uv /usr/bin/uvx /usr/local/bin/

COPY --from=builder ${WORKING_DIR} ${WORKING_DIR}

WORKDIR ${WORKING_DIR}/src
EXPOSE 5000
ENTRYPOINT [ "bash", "-c"]
10 changes: 3 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = [
{ name = "CERN" }
]
license = "GPL-2.0"
requires-python = ">=3.9"
requires-python = "~=3.14.0"
dependencies = [
"invenio-app-rdm[opensearch2, profiler]==v15.0.0b6.dev0",
"invenio-cern-sync",
Expand All @@ -21,11 +21,6 @@ dependencies = [

[tool.uv]
override-dependencies = [
# On Python <=3.9 type hints require a manual import of __annotations__.
# fastjsonschema>=2.22 starts to use type hints without this manual import and is
# therefore incompatible with Python <=3.9. See https://github.com/horejsek/python-fastjsonschema/issues/211
# Their minimum Python version has now been set to 3.10 for >=2.22
"fastjsonschema<2.22",
"invenio-assets<4.2.5"
]

Expand All @@ -45,9 +40,10 @@ dev = [

[project.optional-dependencies]
sentry = [
"sentry-sdk>=1.45,<2.0.0",
"invenio-logging[sentry]",
]
xrootd = [
"invenio-xrootd==3.1.0",
"requests-kerberos==0.14.0",
"xrootd==5.9.6",
]
2 changes: 0 additions & 2 deletions site/cds_rdm/clc_sync/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

"""CLCSync service."""

import distutils.util

import arrow
import requests
from flask import current_app
Expand Down
Loading
Loading