pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 1 | # |
| 2 | # Copyright 2020-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
| 17 | # We start from an onos image and install the apps. |
| 18 | # We need at least an onos image built with 'tost' profile |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 19 | FROM tost-onos as install |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 20 | |
| 21 | ARG KARAF_VERSION |
| 22 | ARG LOCAL_APPS |
| 23 | |
| 24 | # ENV settings |
| 25 | ENV ONOS=/root/onos |
| 26 | ENV KARAF_ROOT=${ONOS}/apache-karaf-$KARAF_VERSION |
| 27 | ENV APPS_ROOT=${ONOS}/apps |
| 28 | ENV KARAF_M2=${KARAF_ROOT}/system |
| 29 | ENV DOWNLOAD_ROOT=/download |
| 30 | ENV APP_INSTALL_ROOT=/expand |
| 31 | |
| 32 | # Copy the apps to the install stage container |
| 33 | COPY $LOCAL_APPS/ ${DOWNLOAD_ROOT}/ |
| 34 | |
| 35 | RUN apt-get update && \ |
| 36 | apt-get install -y --no-install-recommends \ |
| 37 | unzip && \ |
| 38 | rm -rf /var/lib/apt/lists/* |
| 39 | |
| 40 | WORKDIR ${DOWNLOAD_ROOT} |
| 41 | |
| 42 | # Install the applications |
| 43 | COPY app-install.sh ./app-install.sh |
| 44 | RUN chmod 755 ./app-install.sh |
| 45 | RUN ./app-install.sh |
| 46 | |
| 47 | # Create the final image coping over the installed applications from the install stage |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 48 | FROM tost-onos |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 49 | |
| 50 | ARG KARAF_VERSION |
| 51 | |
| 52 | # The ENV settings must be replicated below as they are not shared between stages |
| 53 | ENV ONOS=/root/onos |
| 54 | ENV KARAF_ROOT=${ONOS}/apache-karaf-$KARAF_VERSION |
| 55 | ENV KARAF_M2=${KARAF_ROOT}/system |
| 56 | ENV APPS_ROOT=${ONOS}/apps |
| 57 | |
| 58 | COPY --from=install ${KARAF_M2}/ ${KARAF_M2}/ |
| 59 | COPY --from=install ${APPS_ROOT}/ ${APPS_ROOT}/ |
| 60 | |
| 61 | # Label image |
| 62 | ARG org_label_schema_version=unknown |
| 63 | ARG org_label_schema_vcs_url=unknown |
| 64 | ARG org_label_schema_vcs_ref=unknown |
| 65 | ARG org_label_schema_build_date=unknown |
| 66 | ARG org_onosproject_vcs_commit_date=unknown |
| 67 | |
| 68 | LABEL org.label-schema.schema-version=1.0 \ |
| 69 | org.label-schema.name=tost \ |
| 70 | org.label-schema.version=$org_label_schema_version \ |
| 71 | org.label-schema.vcs-url=$org_label_schema_vcs_url \ |
| 72 | org.label-schema.vcs-ref=$org_label_schema_vcs_ref \ |
| 73 | org.label-schema.build-date=$org_label_schema_build_date \ |
| 74 | org.onosproject.vcs-commit-date=$org_onosproject_vcs_commit_date |