Skip to content

Investigate Nx tweaks to the their docker build scripts #326

@ptr727

Description

@ptr727

Describe the problem?

Nx added some tweaks to their Dockerfile build, investigate and determine if it should be incorporated.

They are registering config specific to running under docker?

Dockerfile:

RUN echo "currentOsVariantOverride=docker" >> /opt/${COMPANY}/mediaserver/etc/mediaserver.conf

# Disable root-tool to run in non-privileged mode.
# The /recording folder is not recognized correctly, and the issue can be observed in verbose logs:
# /recordings (ext4) — not a folder.
RUN echo "ignoreRootTool=true" >> /opt/${COMPANY}/mediaserver/etc/mediaserver.conf

mediaserver.conf:

# Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
[General]
cameraSettingsOptimization=true
lowPriorityPassword=1
appserverPassword=admin
port=7001
currentOsVariantOverride=docker
ignoreRootTool=true

They document using tmpfs for /opt/networkoptix/mediaserver/tmp but the compose file mounts as /tmp?

tmpfs:

Volumes

Default source mount location Description Container mount point
TMPFS Unix socket and tmp files /opt/networkoptix/mediaserver/tmp

docker-compose:

volumes:
      - ${VOLUMES_PATH}/etc:/opt/${COMPANY}/mediaserver/etc
      - ${VOLUMES_PATH}/var:/opt/${COMPANY}/mediaserver/var
      - ${VOLUMES_PATH}/nx_ini:/home/${COMPANY}/.config/nx_ini
      - ${VOLUMES_PATH}/entrypoint.d:/opt/mediaserver/entrypoint.d
      - ${VOLUMES_PATH}/recordings:/recordings
    tmpfs:
      - /tmp

They added a mechanisms for extension / plugins, it still requires the docker image to be modified, mounting plugins in a volume is preferred?

nxai-plugin:

RUN mkdir -p ${PLUGIN_DIR} && \
    curl https://artifactory.nxvms.dev/artifactory/nxai_open/NXAIPlugin/${VER}/libnxai_plugin.so \
      -o ${PLUGIN_DIR}/libnxai_plugin.so && \
    chmod +x -R ${PLUGIN_DIR}

entrypoint.sh:

# Run user-supplied initialization scripts.
if [[ -d "${ENTRYPOINT_SCRIPTS_DIR}" ]]; then
    echo "Loading user's custom *.sh,*.py scripts from ${ENTRYPOINT_SCRIPTS_DIR}"
    find "${ENTRYPOINT_SCRIPTS_DIR}" -type f -executable -regex ".*\.\(sh\|py\)" | sort | \
    {
        while read script; do
            if ! "${script}"; then
                echo "Failed to execute ${script}" >&2
                return 1
            fi
        done
    }
fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions