Single docker image with default feature 14/96814/2 14.2.0 14.4.0
authorLuis Gomez <ecelgp@gmail.com>
Wed, 7 Jul 2021 03:59:01 +0000 (20:59 -0700)
committerLuis Gomez <ecelgp@gmail.com>
Wed, 7 Jul 2021 04:11:17 +0000 (21:11 -0700)
docker run --name odl-docker -d -p 8101:8101 -p 8181:8181
-e FEATURES="odl-restconf,odl-netconf-topology" odl-docker

Signed-off-by: Luis Gomez <ecelgp@gmail.com>
Change-Id: I39d015eacb659dd607679be93d983c52f505f53a

odl-docker/Dockerfile
odl-docker/install_docker.sh
odl-docker/start_docker.sh [new file with mode: 0755]

index f22907cc5c9eab522ae1fc68fee370f84432d337..744890ebba3f7a1758fad83f5791d1ecde5deff8 100644 (file)
@@ -8,7 +8,7 @@
 # http://www.eclipse.org/legal/epl-v10.html
 ##############################################################################
 
-FROM openjdk:11
+FROM openjdk:11 AS stage0
 
 WORKDIR /opt/opendaylight
 
@@ -18,6 +18,16 @@ RUN groupadd -r karaf --gid=8181 && \
     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
index 7dae6c420a295e58e79f58026491206c8edfc24e..75ab619a582ce55b7e6953c5de533d366f62350b 100755 (executable)
@@ -1,12 +1,21 @@
 #!/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
diff --git a/odl-docker/start_docker.sh b/odl-docker/start_docker.sh
new file mode 100755 (executable)
index 0000000..e8748ee
--- /dev/null
@@ -0,0 +1,18 @@
+#!/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