diff options
author | Singal, Kapil (ks220y) <ks220y@att.com> | 2021-06-14 12:16:06 -0400 |
---|---|---|
committer | KAPIL SINGAL <ks220y@att.com> | 2021-06-14 16:58:40 +0000 |
commit | 3d55822228b8b8d935ddd827ba7d6b1f3f292cbc (patch) | |
tree | 09376dbc4652e0a5b0f21385bf881cfc2df49ea5 /odlsli | |
parent | d783f849b949e551f00febe14b5b944db378d4cc (diff) |
Effort to reduce image size and layers
Issue-ID: CCSDK-3226
Change-Id: I3bb7b8a9eeef866fdc23804e06b2908d33f63c06
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Diffstat (limited to 'odlsli')
-rw-r--r-- | odlsli/odlsli-alpine/src/main/docker/Dockerfile | 64 |
1 files changed, 35 insertions, 29 deletions
diff --git a/odlsli/odlsli-alpine/src/main/docker/Dockerfile b/odlsli/odlsli-alpine/src/main/docker/Dockerfile index fccf7f74..0b6dbbf7 100644 --- a/odlsli/odlsli-alpine/src/main/docker/Dockerfile +++ b/odlsli/odlsli-alpine/src/main/docker/Dockerfile @@ -3,60 +3,66 @@ FROM ${base.image.name}:${project.docker.latestfulltag.version} AS stage0 USER root -# copy the opendaylight credentials +# Copy the opendaylight credentials COPY idmlight.db.mv.db $ODL_HOME/data -# copy CCSDK mvn artifacts to ODL repository +# Copy CCSDK mvn artifacts to ODL repository COPY system /tmp/system RUN rsync -a /tmp/system $ODL_HOME -# copy deliverables to opt +# Copy deliverables to opt COPY opt /opt COPY org.ops4j.pax.logging.cfg $ODL_HOME/etc/org.ops4j.pax.logging.cfg -# CCSDK SLI -ENV CCSDK_SLI_CORE_REPO mvn:org.onap.ccsdk.sli.core/ccsdk-sli-core-all/${ccsdk.sli.version}/xml/features -ENV CCSDK_SLI_ADAPTORS_REPO mvn:org.onap.ccsdk.sli.adaptors/ccsdk-sli-adaptors-all/${ccsdk.sli.version}/xml/features -ENV CCSDK_SLI_NORTHBOUND_REPO mvn:org.onap.ccsdk.sli.northbound/ccsdk-sli-northbound-all/${ccsdk.sli.version}/xml/features -ENV CCSDK_SLI_PLUGINS_REPO mvn:org.onap.ccsdk.sli.plugins/ccsdk-sli-plugins-all/${ccsdk.sli.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 +# CCSDK SLI FEATURES +ENV CCSDK_SLI_FEATURES_REPO mvn:org.onap.ccsdk.sli.core/ccsdk-sli-core-all/${ccsdk.sli.version}/xml/features,\ +mvn:org.onap.ccsdk.sli.adaptors/ccsdk-sli-adaptors-all/${ccsdk.sli.version}/xml/features,\ +mvn:org.onap.ccsdk.sli.northbound/ccsdk-sli-northbound-all/${ccsdk.sli.version}/xml/features,\ +mvn:org.onap.ccsdk.sli.plugins/ccsdk-sli-plugins-all/${ccsdk.sli.version}/xml/features + +# CCSDK SDNR FEATURES +ENV CCSDK_SDNR_FEATURES_REPO mvn:org.onap.ccsdk.oran/a1-adapter-northbound/${ccsdk.oran.a1adapter.version}/xml/features,\ +mvn:org.onap.ccsdk.features/ccsdk-features-all/${ccsdk.features.version}/xml/features,\ +mvn:org.onap.ccsdk.features.sdnr.northbound/sdnr-northbound-all/${ccsdk.features.version}/xml/features,\ +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 # ODL and CCSDK SLI featuresBoot defined in pom.xml ENV ODL_BOOT_FEATURES_EXTRA ${odl.boot.features.extra} +# Backing up existing karaf cfg and updating features boot and features repository 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 +RUN sed -i -e "\|featuresRepositories|s|$|,${CCSDK_SLI_FEATURES_REPO},${CCSDK_SDNR_FEATURES_REPO} |" $ODL_HOME/etc/org.apache.karaf.features.cfg + +# Enable wheel and create a group and user +RUN 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 + +# Changing ownership and permission of /opt +RUN chown -R odl:odl /opt && chmod -R 755 /opt ## END OF STAGE0 ## +################################################# ## This will create actual image -FROM ${base.image.name}:${project.docker.latestfulltag.version} +FROM scratch LABEL maintainer="CCSDK Team (onap-ccsdk@lists.onap.org)" USER root +ENV JAVA_HOME /opt/java/openjdk +ENV ODL_HOME /opt/opendaylight/current ENV SDNC_CONFIG_DIR /opt/onap/ccsdk/data/properties ENV ANSIBLE_GPG_KEY ${ansible.gpg.key} -ENV CCSDKFEATUREVERSION ${ccsdk.features.version} - -# 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 +# Copy Everything from stage0 +COPY --from=stage0 / / USER odl +WORKDIR $ODL_HOME ENTRYPOINT /opt/onap/ccsdk/bin/startODL.sh |