blob: c48185a25a9c6a894c1dda7b910134394ba58ea5 [file] [log] [blame]
Joey Armstrong695ba5c2023-01-20 11:17:49 -05001# Copyright 2018-2023 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
15
16# Download and copy the specified onos apps
Andrea Campanella9edafd02021-11-19 14:44:35 -080017FROM maven:3.6.3-openjdk-11-slim as download
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040018
19# The ENV settings must be replicated below as they are not shared between stages
20ENV DOWNLOAD_ROOT=/download
21RUN mkdir -p ${DOWNLOAD_ROOT}
22WORKDIR ${DOWNLOAD_ROOT}
23COPY mvn_settings.* ${DOWNLOAD_ROOT}/
24RUN ./mvn_settings.sh
25ADD dependencies.xml .
26
27ARG LOCAL_ONOSAPPS
28COPY local_imports/ /local_imports/
29RUN if [ -n "$LOCAL_ONOSAPPS" ] ; then \
30 cp /local_imports/oar/* ${DOWNLOAD_ROOT}/ ; \
31else \
32 mvn dependency:copy -Dmdep.useBaseVersion=true -DoutputDirectory=${DOWNLOAD_ROOT} -Dsilent=true -f dependencies.xml -s mvn_settings.xml ; \
33fi
34
35
36# Unpack and install specific apps from download stage
Andrea Campanellab7362602022-06-30 15:30:48 +020037FROM onosproject/onos:2.5.8 as install
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040038
39# The ENV settings must be replicated below as they are not shared between stages
40ENV ONOS=/root/onos
Andrea Campanellad41fe532022-01-14 11:11:29 +010041ENV KARAF_VERSION=4.2.14
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040042ENV KARAF_ROOT=${ONOS}/apache-karaf-${KARAF_VERSION}
43ENV APPS_ROOT=${ONOS}/apps
44ENV KARAF_M2=${KARAF_ROOT}/system
45ENV DOWNLOAD_ROOT=/download
46ENV APP_INSTALL_ROOT=/expand
47
48# Copy the downloaded artifact to the install stage container
49COPY --from=download ${DOWNLOAD_ROOT} ${DOWNLOAD_ROOT}
50
Matteo Scandoloe28d3e42020-02-07 12:08:41 -080051RUN apt-get update
52RUN apt-get install unzip -y
53
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040054# Install the applications
55COPY app-install.sh ./app-install.sh
Joey Armstrong7c3a1e02023-07-01 16:21:24 -040056RUN chmod 755 app-install.sh
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040057RUN ./app-install.sh
58
59
60# Create the final image coping over the installed applications from the install stage
Andrea Campanellab7362602022-06-30 15:30:48 +020061FROM onosproject/onos:2.5.8
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040062
63# The ENV settings must be replicated below as they are not shared between stages
64ENV ONOS=/root/onos
Andrea Campanellad41fe532022-01-14 11:11:29 +010065ENV KARAF_VERSION=4.2.14
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040066ENV KARAF_ROOT=${ONOS}/apache-karaf-${KARAF_VERSION}
67ENV KARAF_M2=${KARAF_ROOT}/system
68ENV APPS_ROOT=${ONOS}/apps
Andrea Campanellabbec83d2020-09-23 09:40:39 +020069ENV 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 -040070
71COPY --from=install ${KARAF_M2}/ ${KARAF_M2}/
72RUN echo "${KARAF_M2} ${APPS_ROOT}"
73COPY --from=install ${APPS_ROOT}/ ${APPS_ROOT}/
74COPY network-cfg.json $KARAF_ROOT/../config/network-cfg.json
75
Joey Armstrong7c3a1e02023-07-01 16:21:24 -040076## -----------------------------------------------------------------------
77## Intent: Create package install directories.
78## -----------------------------------------------------------------------
79COPY etc/mkdir-touch-active.sh .
80RUN chmod 555 mkdir-touch-active.sh
81RUN ./mkdir-touch-active.sh\
82 $ONOS/apps/org.onosproject.hostprovider\
83 $ONOS/apps/org.onosproject.openflow-base\
84 $ONOS/apps/org.onosproject.lldpprovider\
85 $ONOS/apps/org.onosproject.mcast\
86 $ONOS/apps/org.onosproject.segmentrouting
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040087
Joey Armstrong7c3a1e02023-07-01 16:21:24 -040088## [DEBUG]
89## RUN find "$ONOS/apps" -ls; exit 1
90
91## -----------------------------------------------------------------------
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040092# Label image
Joey Armstrong7c3a1e02023-07-01 16:21:24 -040093## -----------------------------------------------------------------------
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040094ARG org_label_schema_version=unknown
95ARG org_label_schema_vcs_url=unknown
96ARG org_label_schema_vcs_ref=unknown
97ARG org_label_schema_build_date=unknown
98ARG org_opencord_vcs_commit_date=unknown
99
100LABEL org.label-schema.schema-version=1.0 \
Matt Jeanneretd8c37942019-05-14 18:06:50 -0400101 org.label-schema.name=voltha-onos \
Matt Jeanneretc7b437c2019-05-13 12:33:08 -0400102 org.label-schema.version=$org_label_schema_version \
103 org.label-schema.vcs-url=$org_label_schema_vcs_url \
104 org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
105 org.label-schema.build-date=$org_label_schema_build_date \
106 org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date
Joey Armstrong7c3a1e02023-07-01 16:21:24 -0400107
108# [EOF]