Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 1 | # Copyright 2018 the original author or authors. |
| 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 | |
| 15 | |
| 16 | # Download and copy the specified onos apps |
Andrea Campanella | 9edafd0 | 2021-11-19 14:44:35 -0800 | [diff] [blame] | 17 | FROM maven:3.6.3-openjdk-11-slim as download |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 18 | |
| 19 | # The ENV settings must be replicated below as they are not shared between stages |
| 20 | ENV DOWNLOAD_ROOT=/download |
| 21 | RUN mkdir -p ${DOWNLOAD_ROOT} |
| 22 | WORKDIR ${DOWNLOAD_ROOT} |
| 23 | COPY mvn_settings.* ${DOWNLOAD_ROOT}/ |
| 24 | RUN ./mvn_settings.sh |
| 25 | ADD dependencies.xml . |
| 26 | |
| 27 | ARG LOCAL_ONOSAPPS |
| 28 | COPY local_imports/ /local_imports/ |
| 29 | RUN if [ -n "$LOCAL_ONOSAPPS" ] ; then \ |
| 30 | cp /local_imports/oar/* ${DOWNLOAD_ROOT}/ ; \ |
| 31 | else \ |
| 32 | mvn dependency:copy -Dmdep.useBaseVersion=true -DoutputDirectory=${DOWNLOAD_ROOT} -Dsilent=true -f dependencies.xml -s mvn_settings.xml ; \ |
| 33 | fi |
| 34 | |
| 35 | |
| 36 | # Unpack and install specific apps from download stage |
Andrea Campanella | 19599ac | 2022-03-17 16:07:28 +0100 | [diff] [blame] | 37 | FROM onosproject/onos:2.5.7-rc2 as install |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 38 | |
| 39 | # The ENV settings must be replicated below as they are not shared between stages |
| 40 | ENV ONOS=/root/onos |
Andrea Campanella | d41fe53 | 2022-01-14 11:11:29 +0100 | [diff] [blame] | 41 | ENV KARAF_VERSION=4.2.14 |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 42 | ENV KARAF_ROOT=${ONOS}/apache-karaf-${KARAF_VERSION} |
| 43 | ENV APPS_ROOT=${ONOS}/apps |
| 44 | ENV KARAF_M2=${KARAF_ROOT}/system |
| 45 | ENV DOWNLOAD_ROOT=/download |
| 46 | ENV APP_INSTALL_ROOT=/expand |
| 47 | |
| 48 | # Copy the downloaded artifact to the install stage container |
| 49 | COPY --from=download ${DOWNLOAD_ROOT} ${DOWNLOAD_ROOT} |
| 50 | |
Matteo Scandolo | e28d3e4 | 2020-02-07 12:08:41 -0800 | [diff] [blame] | 51 | RUN apt-get update |
| 52 | RUN apt-get install unzip -y |
| 53 | |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 54 | # Install the applications |
| 55 | COPY app-install.sh ./app-install.sh |
| 56 | RUN chmod 755 ./app-install.sh |
| 57 | RUN ./app-install.sh |
| 58 | |
| 59 | |
| 60 | # Create the final image coping over the installed applications from the install stage |
Andrea Campanella | 19599ac | 2022-03-17 16:07:28 +0100 | [diff] [blame] | 61 | FROM onosproject/onos:2.5.7-rc2 |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 62 | |
| 63 | # The ENV settings must be replicated below as they are not shared between stages |
| 64 | ENV ONOS=/root/onos |
Andrea Campanella | d41fe53 | 2022-01-14 11:11:29 +0100 | [diff] [blame] | 65 | ENV KARAF_VERSION=4.2.14 |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 66 | ENV KARAF_ROOT=${ONOS}/apache-karaf-${KARAF_VERSION} |
| 67 | ENV KARAF_M2=${KARAF_ROOT}/system |
| 68 | ENV APPS_ROOT=${ONOS}/apps |
Andrea Campanella | bbec83d | 2020-09-23 09:40:39 +0200 | [diff] [blame] | 69 | 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] | 70 | |
| 71 | COPY --from=install ${KARAF_M2}/ ${KARAF_M2}/ |
| 72 | RUN echo "${KARAF_M2} ${APPS_ROOT}" |
| 73 | COPY --from=install ${APPS_ROOT}/ ${APPS_ROOT}/ |
| 74 | COPY network-cfg.json $KARAF_ROOT/../config/network-cfg.json |
| 75 | |
| 76 | RUN touch $ONOS/apps/org.onosproject.hostprovider/active |
| 77 | RUN touch $ONOS/apps/org.onosproject.openflow-base/active |
Matteo Scandolo | 884a70c | 2019-10-29 14:58:33 -0700 | [diff] [blame] | 78 | RUN touch $ONOS/apps/org.onosproject.lldpprovider/active |
Andrea Campanella | 16895ca | 2021-03-10 15:50:04 +0100 | [diff] [blame] | 79 | RUN touch $ONOS/apps/org.onosproject.mcast/active |
Andrea Campanella | 67f6157 | 2021-05-28 18:43:02 +0200 | [diff] [blame] | 80 | RUN touch $ONOS/apps/org.onosproject.segmentrouting/active |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 81 | |
| 82 | # Label image |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 83 | ARG org_label_schema_version=unknown |
| 84 | ARG org_label_schema_vcs_url=unknown |
| 85 | ARG org_label_schema_vcs_ref=unknown |
| 86 | ARG org_label_schema_build_date=unknown |
| 87 | ARG org_opencord_vcs_commit_date=unknown |
| 88 | |
| 89 | LABEL org.label-schema.schema-version=1.0 \ |
Matt Jeanneret | d8c3794 | 2019-05-14 18:06:50 -0400 | [diff] [blame] | 90 | org.label-schema.name=voltha-onos \ |
Matt Jeanneret | c7b437c | 2019-05-13 12:33:08 -0400 | [diff] [blame] | 91 | org.label-schema.version=$org_label_schema_version \ |
| 92 | org.label-schema.vcs-url=$org_label_schema_vcs_url \ |
| 93 | org.label-schema.vcs-ref=$org_label_schema_vcs_ref \ |
| 94 | org.label-schema.build-date=$org_label_schema_build_date \ |
| 95 | org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date |