Installing Additional APT Packages in Tutor (Ulmo Release) – Best Practice

Hi Everyone,

I’m currently running the latest Open edX Ulmo release using Tutor 21.0.2 on a single AWS EC2 instance.

For Python dependencies, I understand that we can easily add extra packages via the OPENEDX_EXTRA_PIP_REQUIREMENTS setting in config.yml. For example:

OPENEDX_EXTRA_PIP_REQUIREMENTS:
- djangosaml2idp==0.7.2

However, I’m unsure about the recommended approach for installing additional APT packages (e.g., system-level dependencies like xmlsec1) during the image build process.

At the moment, I’m installing them manually by accessing the LMS container:

docker exec -it -u root tutor_local-lms-1 bash
apt-get update
apt install xmlsec1

While this works temporarily, I understand this is not a persistent or production-friendly solution, as changes will be lost on container rebuild.

Could anyone please guide me on:

  • The correct way to install APT packages during the Tutor image build process
  • Whether this should be handled via a custom Dockerfile, plugin, or any Tutor-specific mechanism
  • Any relevant documentation or real-world examples

Any guidance or best practices would be greatly appreciated.

Thanks in advance!

Hi @Mahendra, you can create a plugin that uses the openedx-dockerfile-minimal patch to add custom commands when building an image. Something like this should work:

from tutor import hooks

hooks.Filters.ENV_PATCHES.add_item(
    (
        "openedx-dockerfile-minimal",
        """
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
    --mount=type=cache,target=/var/lib/apt,sharing=locked \
    apt update \
    && apt install -y xmlsec1
"""
    )
)
1 Like