blob: 9c649008bad6a8790809f8ac0faee2a631f0d696 [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
Joey Armstrongc0668642024-02-06 17:00:39 -050077
78# ----------------------------------------------------
79# [TODO] Morph into a loop: install pkg; pkg --version
80# ----------------------------------------------------
81RUN apt-get install -y rsync
82RUN apt-get install -y unzip
83
84RUN rsync --version | head -n1
85RUN unzip --help | head -n1
Matteo Scandoloe28d3e42020-02-07 12:08:41 -080086
Joey Armstrong4a4286e2024-01-03 17:04:01 -050087RUN <<BANNER
88 echo ""
89 echo "** -----------------------------------------------------------------------"
90 echo "** Install applications (./app-install.sh)"
91 echo "** -----------------------------------------------------------------------"
92BANNER
93
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040094# Install the applications
95COPY app-install.sh ./app-install.sh
Joey Armstrong7c3a1e02023-07-01 16:21:24 -040096RUN chmod 755 app-install.sh
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040097RUN ./app-install.sh
98
Matt Jeanneretc7b437c2019-05-13 12:33:08 -040099# Create the final image coping over the installed applications from the install stage
Andrea Campanellab7362602022-06-30 15:30:48 +0200100FROM onosproject/onos:2.5.8
Matt Jeanneretc7b437c2019-05-13 12:33:08 -0400101
102# The ENV settings must be replicated below as they are not shared between stages
103ENV ONOS=/root/onos
Andrea Campanellad41fe532022-01-14 11:11:29 +0100104ENV KARAF_VERSION=4.2.14
Matt Jeanneretc7b437c2019-05-13 12:33:08 -0400105ENV KARAF_ROOT=${ONOS}/apache-karaf-${KARAF_VERSION}
106ENV KARAF_M2=${KARAF_ROOT}/system
107ENV APPS_ROOT=${ONOS}/apps
Andrea Campanellabbec83d2020-09-23 09:40:39 +0200108ENV 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 -0400109
Joey Armstrong4a4286e2024-01-03 17:04:01 -0500110RUN <<BANNER
111 echo ""
112 echo "** -----------------------------------------------------------------------"
113 echo "** COPY --from=install ${KARAF_M2}/ ${KARAF_M2}"
114 echo "** -----------------------------------------------------------------------"
115BANNER
116
Matt Jeanneretc7b437c2019-05-13 12:33:08 -0400117COPY --from=install ${KARAF_M2}/ ${KARAF_M2}/
118RUN echo "${KARAF_M2} ${APPS_ROOT}"
119COPY --from=install ${APPS_ROOT}/ ${APPS_ROOT}/
120COPY network-cfg.json $KARAF_ROOT/../config/network-cfg.json
121
Joey Armstrong7c3a1e02023-07-01 16:21:24 -0400122## -----------------------------------------------------------------------
123## Intent: Create package install directories.
124## -----------------------------------------------------------------------
125COPY etc/mkdir-touch-active.sh .
126RUN chmod 555 mkdir-touch-active.sh
127RUN ./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 Jeanneretc7b437c2019-05-13 12:33:08 -0400133
Joey Armstrong7c3a1e02023-07-01 16:21:24 -0400134## [DEBUG]
135## RUN find "$ONOS/apps" -ls; exit 1
136
137## -----------------------------------------------------------------------
Matt Jeanneretc7b437c2019-05-13 12:33:08 -0400138# Label image
Joey Armstrong7c3a1e02023-07-01 16:21:24 -0400139## -----------------------------------------------------------------------
Matt Jeanneretc7b437c2019-05-13 12:33:08 -0400140ARG org_label_schema_version=unknown
141ARG org_label_schema_vcs_url=unknown
142ARG org_label_schema_vcs_ref=unknown
143ARG org_label_schema_build_date=unknown
144ARG org_opencord_vcs_commit_date=unknown
145
146LABEL org.label-schema.schema-version=1.0 \
Matt Jeanneretd8c37942019-05-14 18:06:50 -0400147 org.label-schema.name=voltha-onos \
Matt Jeanneretc7b437c2019-05-13 12:33:08 -0400148 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 Armstrong7c3a1e02023-07-01 16:21:24 -0400153
Joey Armstrong4a4286e2024-01-03 17:04:01 -0500154## Inline as a debugging breakpoint
155# RUN <<FATAL
156# echo ""
157# echo "OUTA HERE"
158# exit 1
159#FATAL
160
161# [EOF]