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 |
| 77 | RUN apt-get install unzip -y |
| 78 | |
Joey Armstrong | 4a4286e | 2024-01-03 17:04:01 -0500 | [diff] [blame] | 79 | RUN <<BANNER |
| 80 | echo "" |
| 81 | echo "** -----------------------------------------------------------------------" |
| 82 | echo "** Install applications (./app-install.sh)" |
| 83 | echo "** -----------------------------------------------------------------------" |
| 84 | BANNER |
| 85 | |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 86 | # Install the applications |
| 87 | COPY app-install.sh ./app-install.sh |
Joey Armstrong | 7c3a1e0 | 2023-07-01 16:21:24 -0400 | [diff] [blame] | 88 | RUN chmod 755 app-install.sh |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 89 | RUN ./app-install.sh |
| 90 | |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 91 | # 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] | 92 | FROM onosproject/onos:2.5.8 |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 93 | |
| 94 | # The ENV settings must be replicated below as they are not shared between stages |
| 95 | ENV ONOS=/root/onos |
Andrea Campanella | d41fe53 | 2022-01-14 11:11:29 +0100 | [diff] [blame] | 96 | ENV KARAF_VERSION=4.2.14 |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 97 | ENV KARAF_ROOT=${ONOS}/apache-karaf-${KARAF_VERSION} |
| 98 | ENV KARAF_M2=${KARAF_ROOT}/system |
| 99 | ENV APPS_ROOT=${ONOS}/apps |
Andrea Campanella | bbec83d | 2020-09-23 09:40:39 +0200 | [diff] [blame] | 100 | 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] | 101 | |
Joey Armstrong | 4a4286e | 2024-01-03 17:04:01 -0500 | [diff] [blame] | 102 | RUN <<BANNER |
| 103 | echo "" |
| 104 | echo "** -----------------------------------------------------------------------" |
| 105 | echo "** COPY --from=install ${KARAF_M2}/ ${KARAF_M2}" |
| 106 | echo "** -----------------------------------------------------------------------" |
| 107 | BANNER |
| 108 | |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 109 | COPY --from=install ${KARAF_M2}/ ${KARAF_M2}/ |
| 110 | RUN echo "${KARAF_M2} ${APPS_ROOT}" |
| 111 | COPY --from=install ${APPS_ROOT}/ ${APPS_ROOT}/ |
| 112 | COPY network-cfg.json $KARAF_ROOT/../config/network-cfg.json |
| 113 | |
Joey Armstrong | 7c3a1e0 | 2023-07-01 16:21:24 -0400 | [diff] [blame] | 114 | ## ----------------------------------------------------------------------- |
| 115 | ## Intent: Create package install directories. |
| 116 | ## ----------------------------------------------------------------------- |
| 117 | COPY etc/mkdir-touch-active.sh . |
| 118 | RUN chmod 555 mkdir-touch-active.sh |
| 119 | RUN ./mkdir-touch-active.sh\ |
| 120 | $ONOS/apps/org.onosproject.hostprovider\ |
| 121 | $ONOS/apps/org.onosproject.openflow-base\ |
| 122 | $ONOS/apps/org.onosproject.lldpprovider\ |
| 123 | $ONOS/apps/org.onosproject.mcast\ |
| 124 | $ONOS/apps/org.onosproject.segmentrouting |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 125 | |
Joey Armstrong | 7c3a1e0 | 2023-07-01 16:21:24 -0400 | [diff] [blame] | 126 | ## [DEBUG] |
| 127 | ## RUN find "$ONOS/apps" -ls; exit 1 |
| 128 | |
| 129 | ## ----------------------------------------------------------------------- |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 130 | # Label image |
Joey Armstrong | 7c3a1e0 | 2023-07-01 16:21:24 -0400 | [diff] [blame] | 131 | ## ----------------------------------------------------------------------- |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 132 | ARG org_label_schema_version=unknown |
| 133 | ARG org_label_schema_vcs_url=unknown |
| 134 | ARG org_label_schema_vcs_ref=unknown |
| 135 | ARG org_label_schema_build_date=unknown |
| 136 | ARG org_opencord_vcs_commit_date=unknown |
| 137 | |
| 138 | LABEL org.label-schema.schema-version=1.0 \ |
Matt Jeanneret | d8c3794 | 2019-05-14 18:06:50 -0400 | [diff] [blame] | 139 | org.label-schema.name=voltha-onos \ |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 140 | org.label-schema.version=$org_label_schema_version \ |
| 141 | org.label-schema.vcs-url=$org_label_schema_vcs_url \ |
| 142 | org.label-schema.vcs-ref=$org_label_schema_vcs_ref \ |
| 143 | org.label-schema.build-date=$org_label_schema_build_date \ |
| 144 | org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date |
Joey Armstrong | 7c3a1e0 | 2023-07-01 16:21:24 -0400 | [diff] [blame] | 145 | |
Joey Armstrong | 4a4286e | 2024-01-03 17:04:01 -0500 | [diff] [blame] | 146 | ## Inline as a debugging breakpoint |
| 147 | # RUN <<FATAL |
| 148 | # echo "" |
| 149 | # echo "OUTA HERE" |
| 150 | # exit 1 |
| 151 | #FATAL |
| 152 | |
| 153 | # [EOF] |