|
| 1 | +# syntax=docker/dockerfile:1.5 |
| 2 | +ARG IGNITION_VERSION=${IGNITION_VERSION} |
| 3 | +FROM inductiveautomation/ignition:${IGNITION_VERSION} as prep |
| 4 | + |
| 5 | +# Temporarily become root for system-level updates (required for 8.1.26+) |
| 6 | +USER root |
| 7 | + |
| 8 | +# Install some prerequisite packages |
| 9 | +RUN apt-get update && apt-get install -y wget ca-certificates jq zip unzip sqlite3 |
| 10 | + |
| 11 | +ARG SUPPLEMENTAL_AZUREIOTINJECTOR_DOWNLOAD_URL="https://files.inductiveautomation.com/third-party/cirrus-link/4.0.15/Azure-Injector-signed.modl" |
| 12 | +ARG SUPPLEMENTAL_AZUREIOTINJECTOR_DOWNLOAD_SHA256="e952629cebaad75825cf6e57c09c01f5f1772065a6e87cc0cda45fdca4b29f13" |
| 13 | +ARG SUPPLEMENTAL_MQTTTRANSMISSION_DOWNLOAD_URL="https://files.inductiveautomation.com/third-party/cirrus-link/4.0.15/MQTT-Transmission-signed.modl" |
| 14 | +ARG SUPPLEMENTAL_MQTTTRANSMISSION_DOWNLOAD_SHA256="1e1e7428cba02dce6e579e6c82e4b8ad30d892438a7504aa0481eff7a5f87952" |
| 15 | +ARG SUPPLEMENTAL_MQTTTRANSMISSIONNIGHTLY_DOWNLOAD_URL="https://ignition-modules-nightly.s3.amazonaws.com/Ignition8/MQTT-Transmission-signed.modl" |
| 16 | +ARG SUPPLEMENTAL_MQTTTRANSMISSIONNIGHTLY_DOWNLOAD_SHA256="notused" |
| 17 | +ARG SUPPLEMENTAL_MQTTENGINE_DOWNLOAD_URL="https://files.inductiveautomation.com/third-party/cirrus-link/4.0.15/MQTT-Engine-signed.modl" |
| 18 | +ARG SUPPLEMENTAL_MQTTENGINE_DOWNLOAD_SHA256="5693c22b391e6da31351f2bb9245ad65e96dff9d02c0a322cb70eb11a2fb86b6" |
| 19 | +ARG SUPPLEMENTAL_MQTTENGINENIGHTLY_DOWNLOAD_URL="https://ignition-modules-nightly.s3.amazonaws.com/Ignition8/MQTT-Engine-signed.modl" |
| 20 | +ARG SUPPLEMENTAL_MQTTENGINENIGHTLY_DOWNLOAD_SHA256="notused" |
| 21 | +ARG SUPPLEMENTAL_MQTTDISTRIBUTOR_DOWNLOAD_URL="https://files.inductiveautomation.com/third-party/cirrus-link/4.0.15/MQTT-Distributor-signed.modl" |
| 22 | +ARG SUPPLEMENTAL_MQTTDISTRIBUTOR_DOWNLOAD_SHA256="5c81be13a9f749899825a99a109502c1eb28be940d060301a1ddf9967d488f9e" |
| 23 | +ARG SUPPLEMENTAL_MQTTDISTRIBUTORNIGHTLY_DOWNLOAD_URL="https://ignition-modules-nightly.s3.amazonaws.com/Ignition8/MQTT-Distributor-signed.modl" |
| 24 | +ARG SUPPLEMENTAL_MQTTDISTRIBUTORNIGHTLY_DOWNLOAD_SHA256="notused" |
| 25 | +ARG SUPPLEMENTAL_GIT_DOWNLOAD_URL="https://www.axone-io.com/Files/Modules/GIT/1.0.1/doc/module/Git-1.0.1.modl" |
| 26 | +ARG SUPPLEMENTAL_GIT_DOWNLOAD_SHA256="notused" |
| 27 | +ARG SUPPLEMENTAL_MODULES |
| 28 | + |
| 29 | +# Set working directory for this prep image and ensure that exits from sub-shells bubble up and report an error |
| 30 | +WORKDIR /root |
| 31 | +SHELL [ "/usr/bin/env", "-S", "bash", "-euo", "pipefail", "-O", "inherit_errexit", "-c" ] |
| 32 | + |
| 33 | +# Retrieve all targeted modules and verify their integrity |
| 34 | +COPY --chmod=0755 retrieve-modules.sh . |
| 35 | +RUN ./retrieve-modules.sh \ |
| 36 | + -m "${SUPPLEMENTAL_MODULES:-}" |
| 37 | + |
| 38 | +# Set CERTIFICATES/EULAS acceptance in gateway backup config db |
| 39 | +COPY base.gwbk . |
| 40 | +COPY --chmod=0755 register-module.sh register-password.sh ./ |
| 41 | +ARG GATEWAY_ADMIN_USERNAME="admin" |
| 42 | +RUN --mount=type=secret,id=gateway-admin-password \ |
| 43 | + unzip -q base.gwbk db_backup_sqlite.idb && \ |
| 44 | + shopt -s nullglob; \ |
| 45 | + for module in *.modl; do \ |
| 46 | + ./register-module.sh \ |
| 47 | + -f "${module}" \ |
| 48 | + -d db_backup_sqlite.idb; \ |
| 49 | + done; \ |
| 50 | + shopt -u nullglob && \ |
| 51 | + ./register-password.sh \ |
| 52 | + -u "${GATEWAY_ADMIN_USERNAME}" \ |
| 53 | + -f /run/secrets/gateway-admin-password \ |
| 54 | + -d db_backup_sqlite.idb && \ |
| 55 | + zip -q -f base.gwbk db_backup_sqlite.idb || \ |
| 56 | + if [[ ${ZIP_EXIT_CODE:=$?} == 12 ]]; then \ |
| 57 | + echo "No changes to internal database needed during module registration."; \ |
| 58 | + else \ |
| 59 | + echo "Unknown error (${ZIP_EXIT_CODE}) encountered during re-packaging of config db, exiting." && \ |
| 60 | + exit ${ZIP_EXIT_CODE}; \ |
| 61 | + fi |
| 62 | + |
| 63 | +# Final Image |
| 64 | +FROM inductiveautomation/ignition:${IGNITION_VERSION} as final |
| 65 | + |
| 66 | +# Temporarily become root for system-level updates (required for 8.1.26+) |
| 67 | +USER root |
| 68 | + |
| 69 | +# Add supplemental packages, such as git if needed/desired |
| 70 | +RUN apt-get update && \ |
| 71 | + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 72 | + git && \ |
| 73 | + rm -rf /var/lib/apt/lists/* |
| 74 | + |
| 75 | +# Embed modules and base gwbk from prep image as well as entrypoint shim |
| 76 | +COPY --from=prep --chown=ignition:ignition /root/*.modl ${IGNITION_INSTALL_LOCATION}/user-lib/modules/ |
| 77 | +COPY --from=prep --chown=ignition:ignition /root/base.gwbk ${IGNITION_INSTALL_LOCATION}/base.gwbk |
| 78 | +COPY --chmod=0755 --chown=root:root docker-entrypoint-shim.sh /usr/local/bin/ |
| 79 | + |
| 80 | +# Return to ignition user |
| 81 | +USER ignition |
| 82 | + |
| 83 | +# Supplement other default environment variables |
| 84 | +ENV ACCEPT_IGNITION_EULA=Y \ |
| 85 | + IGNITION_EDITION=standard \ |
| 86 | + GATEWAY_MODULES_ENABLED=all |
| 87 | + |
| 88 | +# Target the entrypoint shim for any custom logic prior to gateway launch |
| 89 | +ENTRYPOINT [ "docker-entrypoint-shim.sh" ] |
0 commit comments