blob: 0af83e24e30c81d7169948f5e5a1172213cbbe56 [file] [log] [blame]
Joey Armstrong6f63edf2024-01-12 11:30:08 -05001# Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors
Matt Jeanneretc7b437c2019-05-13 12:33:08 -04002#
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 Jeanneretc7b437c2019-05-13 12:33:08 -040015# Download and copy the specified onos apps
Andrea Campanella9edafd02021-11-19 14:44:35 -080016FROM maven:3.6.3-openjdk-11-slim as download
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040017
Joey Armstrong4a4286e2024-01-03 17:04:01 -050018SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
19
20RUN <<BANNER
21 echo ""
22 echo "** -----------------------------------------------------------------------"
23 echo "** Configure maven settings (./mvn_settings.sh)"
24 echo "** -----------------------------------------------------------------------"
25BANNER
26
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040027# The ENV settings must be replicated below as they are not shared between stages
28ENV DOWNLOAD_ROOT=/download
29RUN mkdir -p ${DOWNLOAD_ROOT}
30WORKDIR ${DOWNLOAD_ROOT}
31COPY mvn_settings.* ${DOWNLOAD_ROOT}/
32RUN ./mvn_settings.sh
33ADD dependencies.xml .
34
Joey Armstrong4a4286e2024-01-03 17:04:01 -050035RUN <<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 "** -----------------------------------------------------------------------"
41BANNER
42
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040043ARG LOCAL_ONOSAPPS
44COPY local_imports/ /local_imports/
45RUN if [ -n "$LOCAL_ONOSAPPS" ] ; then \
46 cp /local_imports/oar/* ${DOWNLOAD_ROOT}/ ; \
47else \
48 mvn dependency:copy -Dmdep.useBaseVersion=true -DoutputDirectory=${DOWNLOAD_ROOT} -Dsilent=true -f dependencies.xml -s mvn_settings.xml ; \
49fi
50
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040051# Unpack and install specific apps from download stage
Andrea Campanellab7362602022-06-30 15:30:48 +020052FROM onosproject/onos:2.5.8 as install
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040053
54# The ENV settings must be replicated below as they are not shared between stages
55ENV ONOS=/root/onos
Andrea Campanellad41fe532022-01-14 11:11:29 +010056ENV KARAF_VERSION=4.2.14
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040057ENV KARAF_ROOT=${ONOS}/apache-karaf-${KARAF_VERSION}
58ENV APPS_ROOT=${ONOS}/apps
59ENV KARAF_M2=${KARAF_ROOT}/system
60ENV DOWNLOAD_ROOT=/download
61ENV APP_INSTALL_ROOT=/expand
62
Joey Armstrong4a4286e2024-01-03 17:04:01 -050063RUN <<BANNER
64 echo ""
65 echo "** -----------------------------------------------------------------------"
66 echo "** COPY --from=download ${DOWNLOAD_ROOT} ${DOWNLOAD_ROOT}"
67 echo "** -----------------------------------------------------------------------"
68BANNER
69
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040070# Copy the downloaded artifact to the install stage container
71COPY --from=download ${DOWNLOAD_ROOT} ${DOWNLOAD_ROOT}
72
Joey Armstrong4a4286e2024-01-03 17:04:01 -050073# https://askubuntu.com/questions/1095266/apt-get-update-failed-because-certificate-verification-failed-because-handshake
74RUN apt-get install --reinstall -y ca-certificates
Joey Armstrong6f63edf2024-01-12 11:30:08 -050075RUN rm /etc/apt/sources.list.d/zulu-openjdk.list
Matteo Scandoloe28d3e42020-02-07 12:08:41 -080076RUN apt-get update
77RUN apt-get install unzip -y
78
Joey Armstrong4a4286e2024-01-03 17:04:01 -050079RUN <<BANNER
80 echo ""
81 echo "** -----------------------------------------------------------------------"
82 echo "** Install applications (./app-install.sh)"
83 echo "** -----------------------------------------------------------------------"
84BANNER
85
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040086# Install the applications
87COPY app-install.sh ./app-install.sh
Joey Armstrong7c3a1e02023-07-01 16:21:24 -040088RUN chmod 755 app-install.sh
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040089RUN ./app-install.sh
90
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040091# Create the final image coping over the installed applications from the install stage
Andrea Campanellab7362602022-06-30 15:30:48 +020092FROM onosproject/onos:2.5.8
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040093
94# The ENV settings must be replicated below as they are not shared between stages
95ENV ONOS=/root/onos
Andrea Campanellad41fe532022-01-14 11:11:29 +010096ENV KARAF_VERSION=4.2.14
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040097ENV KARAF_ROOT=${ONOS}/apache-karaf-${KARAF_VERSION}
98ENV KARAF_M2=${KARAF_ROOT}/system
99ENV APPS_ROOT=${ONOS}/apps
Andrea Campanellabbec83d2020-09-23 09:40:39 +0200100ENV JAVA_OPTS='-XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:-UseContainerSupport -Dkaraf.log.console=INFO -Dds.lock.timeout.milliseconds=10000'
Matt Jeanneretc7b437c2019-05-13 12:33:08 -0400101
Joey Armstrong4a4286e2024-01-03 17:04:01 -0500102RUN <<BANNER
103 echo ""
104 echo "** -----------------------------------------------------------------------"
105 echo "** COPY --from=install ${KARAF_M2}/ ${KARAF_M2}"
106 echo "** -----------------------------------------------------------------------"
107BANNER
108
Matt Jeanneretc7b437c2019-05-13 12:33:08 -0400109COPY --from=install ${KARAF_M2}/ ${KARAF_M2}/
110RUN echo "${KARAF_M2} ${APPS_ROOT}"
111COPY --from=install ${APPS_ROOT}/ ${APPS_ROOT}/
112COPY network-cfg.json $KARAF_ROOT/../config/network-cfg.json
113
Joey Armstrong7c3a1e02023-07-01 16:21:24 -0400114## -----------------------------------------------------------------------
115## Intent: Create package install directories.
116## -----------------------------------------------------------------------
117COPY etc/mkdir-touch-active.sh .
118RUN chmod 555 mkdir-touch-active.sh
119RUN ./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 Jeanneretc7b437c2019-05-13 12:33:08 -0400125
Joey Armstrong7c3a1e02023-07-01 16:21:24 -0400126## [DEBUG]
127## RUN find "$ONOS/apps" -ls; exit 1
128
129## -----------------------------------------------------------------------
Matt Jeanneretc7b437c2019-05-13 12:33:08 -0400130# Label image
Joey Armstrong7c3a1e02023-07-01 16:21:24 -0400131## -----------------------------------------------------------------------
Matt Jeanneretc7b437c2019-05-13 12:33:08 -0400132ARG org_label_schema_version=unknown
133ARG org_label_schema_vcs_url=unknown
134ARG org_label_schema_vcs_ref=unknown
135ARG org_label_schema_build_date=unknown
136ARG org_opencord_vcs_commit_date=unknown
137
138LABEL org.label-schema.schema-version=1.0 \
Matt Jeanneretd8c37942019-05-14 18:06:50 -0400139 org.label-schema.name=voltha-onos \
Matt Jeanneretc7b437c2019-05-13 12:33:08 -0400140 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 Armstrong7c3a1e02023-07-01 16:21:24 -0400145
Joey Armstrong4a4286e2024-01-03 17:04:01 -0500146## Inline as a debugging breakpoint
147# RUN <<FATAL
148# echo ""
149# echo "OUTA HERE"
150# exit 1
151#FATAL
152
153# [EOF]