Joey Armstrong | 6f63edf | 2024-01-12 11:30:08 -0500 | [diff] [blame] | 1 | # Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 15 | # Download and copy the specified onos apps |
Andrea Campanella | 9edafd0 | 2021-11-19 14:44:35 -0800 | [diff] [blame] | 16 | FROM maven:3.6.3-openjdk-11-slim as download |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 17 | |
Joey Armstrong | 4a4286e | 2024-01-03 17:04:01 -0500 | [diff] [blame] | 18 | SHELL ["/bin/bash", "-euo", "pipefail", "-c"] |
| 19 | |
| 20 | RUN <<BANNER |
| 21 | echo "" |
| 22 | echo "** -----------------------------------------------------------------------" |
| 23 | echo "** Configure maven settings (./mvn_settings.sh)" |
| 24 | echo "** -----------------------------------------------------------------------" |
| 25 | BANNER |
| 26 | |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 27 | # The ENV settings must be replicated below as they are not shared between stages |
| 28 | ENV DOWNLOAD_ROOT=/download |
| 29 | RUN mkdir -p ${DOWNLOAD_ROOT} |
| 30 | WORKDIR ${DOWNLOAD_ROOT} |
| 31 | COPY mvn_settings.* ${DOWNLOAD_ROOT}/ |
| 32 | RUN ./mvn_settings.sh |
| 33 | ADD dependencies.xml . |
| 34 | |
Joey Armstrong | 4a4286e | 2024-01-03 17:04:01 -0500 | [diff] [blame] | 35 | RUN <<BANNER |
| 36 | echo "" |
| 37 | echo "** -----------------------------------------------------------------------" |
| 38 | echo "** Copy onos artifacts into ${DOWNLOAD_ROOT}" |
| 39 | echo "** URL: https://maven.apache.org/plugins/maven-dependency-plugin/copy-mojo.html" |
| 40 | echo "** -----------------------------------------------------------------------" |
| 41 | BANNER |
| 42 | |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 43 | ARG LOCAL_ONOSAPPS |
| 44 | COPY local_imports/ /local_imports/ |
| 45 | RUN if [ -n "$LOCAL_ONOSAPPS" ] ; then \ |
| 46 | cp /local_imports/oar/* ${DOWNLOAD_ROOT}/ ; \ |
| 47 | else \ |
| 48 | mvn dependency:copy -Dmdep.useBaseVersion=true -DoutputDirectory=${DOWNLOAD_ROOT} -Dsilent=true -f dependencies.xml -s mvn_settings.xml ; \ |
| 49 | fi |
| 50 | |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 51 | # Unpack and install specific apps from download stage |
Andrea Campanella | b736260 | 2022-06-30 15:30:48 +0200 | [diff] [blame] | 52 | FROM onosproject/onos:2.5.8 as install |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 53 | |
| 54 | # The ENV settings must be replicated below as they are not shared between stages |
| 55 | ENV ONOS=/root/onos |
Andrea Campanella | d41fe53 | 2022-01-14 11:11:29 +0100 | [diff] [blame] | 56 | ENV KARAF_VERSION=4.2.14 |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 57 | ENV KARAF_ROOT=${ONOS}/apache-karaf-${KARAF_VERSION} |
| 58 | ENV APPS_ROOT=${ONOS}/apps |
| 59 | ENV KARAF_M2=${KARAF_ROOT}/system |
| 60 | ENV DOWNLOAD_ROOT=/download |
| 61 | ENV APP_INSTALL_ROOT=/expand |
| 62 | |
Joey Armstrong | 4a4286e | 2024-01-03 17:04:01 -0500 | [diff] [blame] | 63 | RUN <<BANNER |
| 64 | echo "" |
| 65 | echo "** -----------------------------------------------------------------------" |
| 66 | echo "** COPY --from=download ${DOWNLOAD_ROOT} ${DOWNLOAD_ROOT}" |
| 67 | echo "** -----------------------------------------------------------------------" |
| 68 | BANNER |
| 69 | |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 70 | # Copy the downloaded artifact to the install stage container |
| 71 | COPY --from=download ${DOWNLOAD_ROOT} ${DOWNLOAD_ROOT} |
| 72 | |
Joey Armstrong | 4a4286e | 2024-01-03 17:04:01 -0500 | [diff] [blame] | 73 | # https://askubuntu.com/questions/1095266/apt-get-update-failed-because-certificate-verification-failed-because-handshake |
| 74 | RUN apt-get install --reinstall -y ca-certificates |
Joey Armstrong | 6f63edf | 2024-01-12 11:30:08 -0500 | [diff] [blame] | 75 | RUN rm /etc/apt/sources.list.d/zulu-openjdk.list |
Matteo Scandolo | e28d3e4 | 2020-02-07 12:08:41 -0800 | [diff] [blame] | 76 | RUN apt-get update |
Joey Armstrong | 62d454f | 2024-02-08 12:29:47 -0500 | [diff] [blame^] | 77 | |
| 78 | # ---------------------------------------------------- |
| 79 | # [TODO] Morph into a loop: install pkg; pkg --version |
| 80 | # ---------------------------------------------------- |
| 81 | RUN apt-get install -y rsync |
| 82 | RUN apt-get install -y unzip |
| 83 | |
| 84 | RUN rsync --version | head -n1 |
| 85 | RUN unzip --help | head -n1 |
Matteo Scandolo | e28d3e4 | 2020-02-07 12:08:41 -0800 | [diff] [blame] | 86 | |
Joey Armstrong | 4a4286e | 2024-01-03 17:04:01 -0500 | [diff] [blame] | 87 | RUN <<BANNER |
| 88 | echo "" |
| 89 | echo "** -----------------------------------------------------------------------" |
| 90 | echo "** Install applications (./app-install.sh)" |
| 91 | echo "** -----------------------------------------------------------------------" |
| 92 | BANNER |
| 93 | |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 94 | # Install the applications |
| 95 | COPY app-install.sh ./app-install.sh |
Joey Armstrong | 7c3a1e0 | 2023-07-01 16:21:24 -0400 | [diff] [blame] | 96 | RUN chmod 755 app-install.sh |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 97 | RUN ./app-install.sh |
| 98 | |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 99 | # Create the final image coping over the installed applications from the install stage |
Andrea Campanella | b736260 | 2022-06-30 15:30:48 +0200 | [diff] [blame] | 100 | FROM onosproject/onos:2.5.8 |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 101 | |
| 102 | # The ENV settings must be replicated below as they are not shared between stages |
| 103 | ENV ONOS=/root/onos |
Andrea Campanella | d41fe53 | 2022-01-14 11:11:29 +0100 | [diff] [blame] | 104 | ENV KARAF_VERSION=4.2.14 |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 105 | ENV KARAF_ROOT=${ONOS}/apache-karaf-${KARAF_VERSION} |
| 106 | ENV KARAF_M2=${KARAF_ROOT}/system |
| 107 | ENV APPS_ROOT=${ONOS}/apps |
Andrea Campanella | bbec83d | 2020-09-23 09:40:39 +0200 | [diff] [blame] | 108 | ENV JAVA_OPTS='-XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:-UseContainerSupport -Dkaraf.log.console=INFO -Dds.lock.timeout.milliseconds=10000' |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 109 | |
Joey Armstrong | 4a4286e | 2024-01-03 17:04:01 -0500 | [diff] [blame] | 110 | RUN <<BANNER |
| 111 | echo "" |
| 112 | echo "** -----------------------------------------------------------------------" |
| 113 | echo "** COPY --from=install ${KARAF_M2}/ ${KARAF_M2}" |
| 114 | echo "** -----------------------------------------------------------------------" |
| 115 | BANNER |
| 116 | |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 117 | COPY --from=install ${KARAF_M2}/ ${KARAF_M2}/ |
| 118 | RUN echo "${KARAF_M2} ${APPS_ROOT}" |
| 119 | COPY --from=install ${APPS_ROOT}/ ${APPS_ROOT}/ |
| 120 | COPY network-cfg.json $KARAF_ROOT/../config/network-cfg.json |
| 121 | |
Joey Armstrong | 7c3a1e0 | 2023-07-01 16:21:24 -0400 | [diff] [blame] | 122 | ## ----------------------------------------------------------------------- |
| 123 | ## Intent: Create package install directories. |
| 124 | ## ----------------------------------------------------------------------- |
| 125 | COPY etc/mkdir-touch-active.sh . |
| 126 | RUN chmod 555 mkdir-touch-active.sh |
| 127 | RUN ./mkdir-touch-active.sh\ |
| 128 | $ONOS/apps/org.onosproject.hostprovider\ |
| 129 | $ONOS/apps/org.onosproject.openflow-base\ |
| 130 | $ONOS/apps/org.onosproject.lldpprovider\ |
| 131 | $ONOS/apps/org.onosproject.mcast\ |
| 132 | $ONOS/apps/org.onosproject.segmentrouting |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 133 | |
Joey Armstrong | 7c3a1e0 | 2023-07-01 16:21:24 -0400 | [diff] [blame] | 134 | ## [DEBUG] |
| 135 | ## RUN find "$ONOS/apps" -ls; exit 1 |
| 136 | |
| 137 | ## ----------------------------------------------------------------------- |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 138 | # Label image |
Joey Armstrong | 7c3a1e0 | 2023-07-01 16:21:24 -0400 | [diff] [blame] | 139 | ## ----------------------------------------------------------------------- |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 140 | ARG org_label_schema_version=unknown |
| 141 | ARG org_label_schema_vcs_url=unknown |
| 142 | ARG org_label_schema_vcs_ref=unknown |
| 143 | ARG org_label_schema_build_date=unknown |
| 144 | ARG org_opencord_vcs_commit_date=unknown |
| 145 | |
| 146 | LABEL org.label-schema.schema-version=1.0 \ |
Matt Jeanneret | d8c3794 | 2019-05-14 18:06:50 -0400 | [diff] [blame] | 147 | org.label-schema.name=voltha-onos \ |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 148 | org.label-schema.version=$org_label_schema_version \ |
| 149 | org.label-schema.vcs-url=$org_label_schema_vcs_url \ |
| 150 | org.label-schema.vcs-ref=$org_label_schema_vcs_ref \ |
| 151 | org.label-schema.build-date=$org_label_schema_build_date \ |
| 152 | org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date |
Joey Armstrong | 7c3a1e0 | 2023-07-01 16:21:24 -0400 | [diff] [blame] | 153 | |
Joey Armstrong | 4a4286e | 2024-01-03 17:04:01 -0500 | [diff] [blame] | 154 | ## Inline as a debugging breakpoint |
| 155 | # RUN <<FATAL |
| 156 | # echo "" |
| 157 | # echo "OUTA HERE" |
| 158 | # exit 1 |
| 159 | #FATAL |
| 160 | |
| 161 | # [EOF] |