summaryrefslogtreecommitdiffstats
path: root/odlsli/odlsli-alpine/src
diff options
context:
space:
mode:
authorSingal, Kapil (ks220y) <ks220y@att.com>2021-03-21 20:45:47 -0400
committerSingal, Kapil (ks220y) <ks220y@att.com>2021-03-21 20:45:47 -0400
commit545f4f8d8895d2b95ec766aa76fbbd135136e570 (patch)
treed52c23e384803d2a12cbeee1b560eb9e6c8e5eef /odlsli/odlsli-alpine/src
parent0bb081c6dd71e6ff541dc97b81a568fda7f2df32 (diff)
Refactoring DockerFile to move few items to stage0 build
Moved manipulating org.apache.karaf.features.cfg file to stage0 build and combines multiple RUN statements to reduce image layers Issue-ID: CCSDK-3226 Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com> Change-Id: I77e8d8bf5da0f5b5772712b6ee037737d9dd6053
Diffstat (limited to 'odlsli/odlsli-alpine/src')
-rw-r--r--odlsli/odlsli-alpine/src/main/docker/Dockerfile55
1 files changed, 29 insertions, 26 deletions
diff --git a/odlsli/odlsli-alpine/src/main/docker/Dockerfile b/odlsli/odlsli-alpine/src/main/docker/Dockerfile
index 81c08868..dd96594c 100644
--- a/odlsli/odlsli-alpine/src/main/docker/Dockerfile
+++ b/odlsli/odlsli-alpine/src/main/docker/Dockerfile
@@ -1,9 +1,9 @@
# Prepare stage for multistage image build
## START OF STAGE0 ##
FROM ${base.image.name}:${project.docker.latestfulltag.version} AS stage0
+USER root
# copy the opendaylight credentials
-USER root
COPY idmlight.db.mv.db $ODL_HOME/data
# copy CCSDK mvn artifacts to ODL repository
@@ -13,47 +13,50 @@ RUN rsync -a /tmp/system $ODL_HOME
# copy deliverables to opt
COPY opt /opt
COPY org.ops4j.pax.logging.cfg $ODL_HOME/etc/org.ops4j.pax.logging.cfg
-## END OF STAGE0 ##
-
-FROM ${base.image.name}:${project.docker.latestfulltag.version}
-
-LABEL maintainer="CCSDK Team (onap-ccsdk@lists.onap.org)"
-USER root
-ENV SDNC_CONFIG_DIR /opt/onap/ccsdk/data/properties
-ENV CCSDKFEATUREVERSION ${ccsdk.features.version}
+# CCSDK SLI
ENV CCSDK_SLI_CORE_REPO mvn:org.onap.ccsdk.sli.core/ccsdk-sli-core-all/${ccsdk.sli.core.version}/xml/features
ENV CCSDK_SLI_ADAPTORS_REPO mvn:org.onap.ccsdk.sli.adaptors/ccsdk-sli-adaptors-all/${ccsdk.sli.adaptors.version}/xml/features
+ENV CCSDK_SLI_NORTHBOUND_REPO mvn:org.onap.ccsdk.sli.northbound/ccsdk-sli-northbound-all/${ccsdk.sli.northbound.version}/xml/features
+ENV CCSDK_SLI_PLUGINS_REPO mvn:org.onap.ccsdk.sli.plugins/ccsdk-sli-plugins-all/${ccsdk.sli.plugins.version}/xml/features
+
+# CCSDK Features
ENV CCSDK_FEATURES_REPO mvn:org.onap.ccsdk.features/ccsdk-features-all/${ccsdk.features.version}/xml/features
+ENV CCSDK_FEATURES_A1ADAPTER_NORTHBOUND_REPO mvn:org.onap.ccsdk.oran/a1-adapter-northbound/${ccsdk.oran.a1adapter.version}/xml/features
+ENV CCSDK_FEATURES_SDNR_NORTHBOUND_REPO mvn:org.onap.ccsdk.features.sdnr.northbound/sdnr-northbound-all/${ccsdk.features.version}/xml/features
ENV CCSDK_FEATURES_SDNR_WT_REPO mvn:org.onap.ccsdk.features.sdnr.wt/sdnr-wt-feature-aggregator/${ccsdk.features.version}/xml/features,\
mvn:org.onap.ccsdk.features.sdnr.wt/sdnr-wt-feature-aggregator-oauth/${ccsdk.features.version}/xml/features,\
mvn:org.onap.ccsdk.features.sdnr.wt/sdnr-wt-feature-aggregator-devicemanager/${ccsdk.features.version}/xml/features,\
mvn:org.onap.ccsdk.features.sdnr.wt/sdnr-wt-feature-aggregator-devicemanager-base/${ccsdk.features.version}/xml/features
-ENV CCSDK_FEATURES_SDNR_NORTHBOUND_REPO mvn:org.onap.ccsdk.features.sdnr.northbound/sdnr-northbound-all/${ccsdk.features.version}/xml/features
-ENV CCSDK_SLI_NORTHBOUND_REPO mvn:org.onap.ccsdk.sli.northbound/ccsdk-sli-northbound-all/${ccsdk.sli.northbound.version}/xml/features
-ENV CCSDK_SLI_PLUGINS_REPO mvn:org.onap.ccsdk.sli.plugins/ccsdk-sli-plugins-all/${ccsdk.sli.plugins.version}/xml/features
-ENV A1ADAPTER_NORTHBOUND_REPO mvn:org.onap.ccsdk.oran/a1-adapter-northbound/${ccsdk.oran.a1adapter.version}/xml/features
-ENV ANSIBLE_GPG_KEY ${ansible.gpg.key}
+
+# ODL and CCSDK SLI featuresBoot defined in pom.xml
ENV ODL_BOOT_FEATURES_EXTRA ${odl.boot.features.extra}
-# Install sudo and IP utilities
-RUN apk update && apk --no-cache add sudo iputils openssl
+RUN cp $ODL_HOME/etc/org.apache.karaf.features.cfg $ODL_HOME/etc/org.apache.karaf.features.cfg.orig
+RUN sed -i -e "\|featuresBoot[^a-zA-Z]|s|$|,${ODL_BOOT_FEATURES_EXTRA}|" $ODL_HOME/etc/org.apache.karaf.features.cfg
+RUN sed -i -e "\|featuresRepositories|s|$|,${CCSDK_SLI_CORE_REPO},${CCSDK_SLI_ADAPTORS_REPO},${CCSDK_SLI_NORTHBOUND_REPO},${CCSDK_SLI_PLUGINS_REPO},${CCSDK_FEATURES_REPO},${CCSDK_FEATURES_A1ADAPTER_NORTHBOUND_REPO},${CCSDK_FEATURES_SDNR_NORTHBOUND_REPO},${CCSDK_FEATURES_SDNR_WT_REPO} |" $ODL_HOME/etc/org.apache.karaf.features.cfg
+
+## END OF STAGE0 ##
+## This will create actual image
+FROM ${base.image.name}:${project.docker.latestfulltag.version}
+LABEL maintainer="CCSDK Team (onap-ccsdk@lists.onap.org)"
+USER root
-# Enable wheel group
-RUN sed -e 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' -i /etc/sudoers
+ENV SDNC_CONFIG_DIR /opt/onap/ccsdk/data/properties
+ENV ANSIBLE_GPG_KEY ${ansible.gpg.key}
+ENV CCSDKFEATUREVERSION ${ccsdk.features.version}
-# Create odl user
-RUN addgroup -S odl && adduser -S odl -G odl
-RUN addgroup odl wheel
+# Install sudo and IP utilities
+RUN apk update \
+ && apk --no-cache add sudo iputils openssl \
+ && sed -i -e 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' /etc/sudoers \
+ && addgroup -S odl \
+ && adduser -S odl -G odl \
+ && addgroup odl wheel
COPY --from=stage0 --chown=odl:odl /opt /opt
-# Add CCSDK repositories to boot repositories
-RUN cp $ODL_HOME/etc/org.apache.karaf.features.cfg $ODL_HOME/etc/org.apache.karaf.features.cfg.orig
-RUN sed -i -e "\|featuresRepositories|s|$|, ${CCSDK_SLI_CORE_REPO}, ${CCSDK_SLI_ADAPTORS_REPO}, ${CCSDK_SLI_NORTHBOUND_REPO}, ${CCSDK_SLI_PLUGINS_REPO}, ${CCSDK_FEATURES_REPO}, ${A1ADAPTER_NORTHBOUND_REPO}, ${CCSDK_FEATURES_SDNR_NORTHBOUND_REPO}, ${CCSDK_FEATURES_SDNR_WT_REPO} |" $ODL_HOME/etc/org.apache.karaf.features.cfg
-RUN sed -i -e "\|featuresBoot[^a-zA-Z]|s|$|,${ODL_BOOT_FEATURES_EXTRA}|" $ODL_HOME/etc/org.apache.karaf.features.cfg
-
USER odl
ENTRYPOINT /opt/onap/ccsdk/bin/startODL.sh