Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-27514

Allow to build Nuxeo Docker images with packages installed at build time

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 11.1, 2021.0
    • Component/s: CI/CD

      Description

      With this ticket we now have:

      • A way to build a Nuxeo Docker image, see below.
      • The Nuxeo Server Docker image built this way. It is still called nuxeo/nuxeo but will be called nuxeo/slim once the Content Platform image (including OSS converters and packages) is ready, see NXP-28133.

      Build time vs runtime

      Compared to the official image, we want to have an image configured at build time instead of runtime.
      Hence, the main changes in the Content Platform Docker image would be:

      • Remove the nuxeo.conf template and use by default the nuxeo.conf provided by the Nuxeo distribution, moved from NUXEO_SERVER/bin/nuxeo.conf to /etc/nuxeo/nuxeo.conf (unless /etc/nuxeo/nuxeo.conf is already mounted).
      • Mount the following directories as volumes in the Dockerfile:
        /var/lib/nuxeo/data
        /var/log/nuxeo
        /tmp
        

        and set the corresponding nuxeo.conf properties in the docker-entrypoint to point to these volumes (if /etc/nuxeo/nuxeo.conf isn't already mounted):

        nuxeo.data.dir=/var/lib/nuxeo/data
        nuxeo.log.dir=/var/log/nuxeo
        nuxeo.tmp.dir=/tmp
        
      • Set additional nuxeo.conf properties in the docker-entrypoint (if /etc/nuxeo/nuxeo.conf isn't already mounted):
        # Set java.io.tmpdir = ${nuxeo.tmp.dir}
        launcher.override.java.tmpdir=true
        # No wizard
        nuxeo.wizard.done=true
        
      • Remove the ability to use /docker-entrypoint-initnuxeo.d for:
        • nuxeo.conf properties
        • ZIP packages
        • shell scripts
        • CLID
      • Remove runtime configuration abilities via environment variables:
        NUXEO_CUSTOM_PARAM (add custom parameters to nuxeo.conf)
        NUXEO_INSTALL_HOTFIX
        NUXEO_PACKAGES
        

        and all the other ones taken into account in the nuxeo.conf template from the official Docker image build.
        Only NUXEO_CLID is kept.

      How to build a Nuxeo Docker image

      Let's use a multi-stage build relying on 2 images:

      • A nuxeo/builder image providing:
        • A Nuxeo server distribution with appropriate permissions in the /distrib directory.
        • An install-packages.sh script to install Nuxeo packages.
      • A nuxeo/base image based on CentOS 7, including:
        • OpenJDK 11.
        • A nuxeo user with a fixed uid (900).
        • The directories required to have the configuration, data and logs outside of the server directory, with appropriate permissions.
        • An entrypoint script to configure the server.
        • The default recommended volumes.
        • The environment variables required by the server.

      To build an image containing a Nuxeo server distribution and some packages installed, let's use a multi-stage build with the nuxeo/builder image and the nuxeo/base image as a base, as in the following sample Dockerfile:

      FROM nuxeo/builder:VERSION as builder
      COPY local/packages /packages
      RUN install-packages.sh /packages
      
      FROM nuxeo/base:VERSION
      RUN yum -y install ...
      COPY --from=builder --chown=900:0 /distrib $NUXEO_HOME
      USER 900
      

      The install-packages.sh script should:

      • Delete NUXEO_SERVER/packages/backup and NUXEO_SERVER/packages/tmp.
      • Keep only NUXEO_SERVER/packages/.packages and NUXEO_SERVER/packages/store to be able to list packages.

      Extras:

      • We could eventually delete everything related to Nuxeo Wizard in the builder stage.
      • Later on, we should think about reworking/removing the package manager (Nuxeo launcher) from the distribution.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 days, 6 hours
                  4d 6h