blob: 02e5a2902c2b06073b05df0f9c30015ad5cafca8 [file] [log] [blame]
# Copyright 2018 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Download and copy the specified onos apps
FROM maven:3.6.3-openjdk-11-slim as download
# The ENV settings must be replicated below as they are not shared between stages
ENV DOWNLOAD_ROOT=/download
RUN mkdir -p ${DOWNLOAD_ROOT}
WORKDIR ${DOWNLOAD_ROOT}
COPY mvn_settings.* ${DOWNLOAD_ROOT}/
RUN ./mvn_settings.sh
ADD dependencies.xml .
ARG LOCAL_ONOSAPPS
COPY local_imports/ /local_imports/
RUN if [ -n "$LOCAL_ONOSAPPS" ] ; then \
cp /local_imports/oar/* ${DOWNLOAD_ROOT}/ ; \
else \
mvn dependency:copy -Dmdep.useBaseVersion=true -DoutputDirectory=${DOWNLOAD_ROOT} -Dsilent=true -f dependencies.xml -s mvn_settings.xml ; \
fi
# Unpack and install specific apps from download stage
FROM onosproject/onos:2.5-latest as install
# The ENV settings must be replicated below as they are not shared between stages
ENV ONOS=/root/onos
ENV KARAF_VERSION=4.2.14
ENV KARAF_ROOT=${ONOS}/apache-karaf-${KARAF_VERSION}
ENV APPS_ROOT=${ONOS}/apps
ENV KARAF_M2=${KARAF_ROOT}/system
ENV DOWNLOAD_ROOT=/download
ENV APP_INSTALL_ROOT=/expand
# Copy the downloaded artifact to the install stage container
COPY --from=download ${DOWNLOAD_ROOT} ${DOWNLOAD_ROOT}
RUN apt-get update
RUN apt-get install unzip -y
# Install the applications
COPY app-install.sh ./app-install.sh
RUN chmod 755 ./app-install.sh
RUN ./app-install.sh
# Create the final image coping over the installed applications from the install stage
FROM onosproject/onos:2.5-latest
# The ENV settings must be replicated below as they are not shared between stages
ENV ONOS=/root/onos
ENV KARAF_VERSION=4.2.14
ENV KARAF_ROOT=${ONOS}/apache-karaf-${KARAF_VERSION}
ENV KARAF_M2=${KARAF_ROOT}/system
ENV APPS_ROOT=${ONOS}/apps
ENV JAVA_OPTS='-XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:-UseContainerSupport -Dkaraf.log.console=INFO -Dds.lock.timeout.milliseconds=10000'
COPY --from=install ${KARAF_M2}/ ${KARAF_M2}/
RUN echo "${KARAF_M2} ${APPS_ROOT}"
COPY --from=install ${APPS_ROOT}/ ${APPS_ROOT}/
COPY network-cfg.json $KARAF_ROOT/../config/network-cfg.json
RUN touch $ONOS/apps/org.onosproject.hostprovider/active
RUN touch $ONOS/apps/org.onosproject.openflow-base/active
RUN touch $ONOS/apps/org.onosproject.lldpprovider/active
RUN touch $ONOS/apps/org.onosproject.mcast/active
RUN touch $ONOS/apps/org.onosproject.segmentrouting/active
# Label image
ARG org_label_schema_version=unknown
ARG org_label_schema_vcs_url=unknown
ARG org_label_schema_vcs_ref=unknown
ARG org_label_schema_build_date=unknown
ARG org_opencord_vcs_commit_date=unknown
LABEL org.label-schema.schema-version=1.0 \
org.label-schema.name=voltha-onos \
org.label-schema.version=$org_label_schema_version \
org.label-schema.vcs-url=$org_label_schema_vcs_url \
org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
org.label-schema.build-date=$org_label_schema_build_date \
org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date