AcademySoftwareFoundation / aswf-docker

Common container configuration
Apache License 2.0
149 stars 36 forks source link

install packages to a different root directory #155

Open glevner opened 2 years ago

glevner commented 2 years ago

We need to install packages to a directory other than /usr/local, because we need to be able to access multiple VFX reference platforms without having to switch between different Docker images.

The shell scripts that build each package allow you to specify any location you want, which is a good start. But adapting the Dockerfiles to build and install all the packages to a different location is a huge headache. (For me, anyway.)

Has anybody else out there been confronted with this problem? And perhaps found a solution?

aloysbaillet commented 2 years ago

You can use the Conan packages to install the available packages anywhere. Building multiple parallel VFX platforms in the same image would be very hard without Conan. Unfortunately not all VFX packages are available yet in Conan.

glevner commented 2 years ago

Thanks for that, Aloys. When you say "the Conan packages", do you mean one can use the Conan recipes provided by ASWF to do this? Or do you mean to use packages from Conan Center?

jfpanisset commented 2 months ago

The direction in which the containers are evolving is that packages will all be built as Conan packages, and then assembled into runnable containers: we're not quite there yet, but getting there.

Starting with VFX 2023, there's a script in scripts/common/install_conanpackages.sh which installs all the Conan packages called for by a container, and if you look in python/aswfdocker/data/ci-image-dockerfile.jinja2 you will find the template for the code installing those packages in /usr/local:

{% if name != "common" %}
RUN --mount=type=cache,target=/opt/conan_home/d \
    --mount=type=bind,rw,target=/opt/conan_home/.conan,source=packages/conan/settings \
    /tmp/install_conanpackages.sh /usr/local vfx${ASWF_VFXPLATFORM_VERSION}
{% else %}
RUN --mount=type=cache,target=/opt/conan_home/d \
    --mount=type=bind,rw,target=/opt/conan_home/.conan,source=packages/conan/settings \
    /tmp/install_conanpackages.sh /usr/local ci_common${CI_COMMON_VERSION}
{% endif %}

So you could change the destination based on the ASWF_VFXPLATFORM_VERSION variable, then:

aswfdocker dockergen

which regenerates the ci-*/Dockerfile files, and rebuild your own containers with a versioned installation destination.

Of course that only handles the Conan packages... It would definitely be better if the aswfdocker command had an option to specify the installation prefix for custom builds.