# http://www.eclipse.org/legal/epl-v10.html
##############################################################################
-FROM openjdk:11
+FROM openjdk:11 AS stage0
WORKDIR /opt/opendaylight
useradd -rm -g karaf --uid=8181 karaf && \
chown -R karaf:karaf .
+FROM scratch
+
+ENV JAVA_HOME /usr/local/openjdk-11
+ENV PATH $PATH:$JAVA_HOME/bin
+ENV FEATURES odl-restconf
+
+COPY --from=stage0 / /
+
+WORKDIR /opt/opendaylight
+
USER karaf
EXPOSE 8101 8181
-CMD ["bin/karaf", "run"]
+CMD ./start_docker.sh
#!/bin/bash
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2021 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
set -x
-VERSION="0.14.1"
-FEATURES="odl-restconf,odl-netconf-topology"
+VERSION="14.1.0"
BASEDIR=$(dirname "$0")
-wget --progress=dot:mega -P /tmp https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/integration/onap-karaf/${VERSION}/onap-karaf-${VERSION}.tar.gz
-tar xzf /tmp/onap-karaf-${VERSION}.tar.gz --directory ${BASEDIR}
-mv ${BASEDIR}/onap-karaf-${VERSION} ${BASEDIR}/opendaylight
-sed -i "s/\(featuresBoot= \|featuresBoot = \)/featuresBoot = ${FEATURES},/g" ${BASEDIR}/opendaylight/etc/org.apache.karaf.features.cfg
-cat ${BASEDIR}/opendaylight/etc/org.apache.karaf.features.cfg
+wget --progress=dot:mega -P /tmp https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/integration/opendaylight/${VERSION}/opendaylight-${VERSION}.tar.gz
+tar xzf /tmp/opendaylight-${VERSION}.tar.gz --directory ${BASEDIR}
+rm /tmp/opendaylight-${VERSION}.tar.gz
+mv ${BASEDIR}/opendaylight-${VERSION} ${BASEDIR}/opendaylight
+cp ${BASEDIR}/start_docker.sh ${BASEDIR}/opendaylight
--- /dev/null
+#!/bin/bash -e
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2021 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+set -x
+
+BASEDIR=$(dirname "$0")
+
+sed -i "s/\(featuresBoot= \|featuresBoot = \)/featuresBoot = ${FEATURES},/g" ${BASEDIR}/etc/org.apache.karaf.features.cfg
+cat ${BASEDIR}/etc/org.apache.karaf.features.cfg
+${BASEDIR}/bin/karaf run