From 30670accb070b20c1c770d1ebbd6d72e24fee2db Mon Sep 17 00:00:00 2001 From: sebdet Date: Tue, 4 Aug 2020 14:16:00 +0200 Subject: Upgrade to java 11 MOve SDC to Java 11, this is one of the PR to move to Jdk 11, jenkins will have to be changed as well Issue-ID: SDC-2725 Change-Id: I85f13f14ba8004f6e9656093a837465a2e4af3e1 Signed-off-by: sebdet Signed-off-by: xuegao Signed-off-by: sebdet --- .../artifacts/Dockerfile | 53 +++++++++++++++++++--- .../artifacts/startup.sh | 7 +-- 2 files changed, 48 insertions(+), 12 deletions(-) (limited to 'openecomp-be/dist/sdc-onboard-backend-docker/artifacts') diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile index 78a8f64a93..9c6275d87a 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile @@ -1,15 +1,54 @@ -FROM onap/base_sdc-jetty:1.7.0 +FROM jetty:9.4.31-jre11-slim -COPY --chown=jetty:jetty chef-solo ${JETTY_BASE}/chef-solo/ +USER root -COPY --chown=jetty:jetty chef-repo/cookbooks ${JETTY_BASE}/chef-solo/cookbooks/ +# Install Chef +RUN set -ex && \ + apt-get update -y && \ + apt-get install -y \ + jq \ + curl \ + vim \ + make \ + gcc \ + ruby \ + ruby-dev \ + libffi-dev \ + libxml2-dev && \ + gem install \ + chef:13.8.5 \ + berkshelf:6.3.1 \ + io-console:0.4.6 \ + etc webrick \ + --no-document && \ + gem cleanup && \ + apt-get update -y && \ + apt-get install -y binutils jq && \ + apt-get clean -ADD --chown=jetty:jetty onboarding-be-*.war ${JETTY_BASE}/webapps/ +# Replace Jetty user ID +ENV USER_JETTY="jetty" +ENV GROUP_JETTY="jetty" +ENV UID_JETTY="352070" +ENV GID_JETTY="35953" -ADD --chown=jetty:jetty api-docs.war ${JETTY_BASE}/webapps/ +# Remove user: +RUN deluser ${USER_JETTY} +#RUN delgroup ${GROUP_JETTY} +RUN echo "${USER_JETTY}:x:${UID_JETTY}:${GID_JETTY}::/home/${USER_JETTY}:Linux User,,,:/home/jetty:/bin/false" >> /etc/passwd +RUN echo "${GROUP_JETTY}:x:${GID_JETTY}:${USER_JETTY}" >> /etc/group +RUN echo "${USER_JETTY}:!:17501:0:99999:7:::" >> /etc/shadow +RUN mkdir /home/${USER_JETTY} && chown ${USER_JETTY}:${GROUP_JETTY} /home/${USER_JETTY} +RUN chown -R jetty:jetty ${JETTY_BASE}/webapps /var/lib/jetty + +USER jetty -COPY --chown=jetty:jetty startup.sh ${JETTY_BASE}/ +COPY --chown=jetty:jetty chef-solo ${JETTY_BASE}/chef-solo/ +COPY --chown=jetty:jetty chef-repo/cookbooks ${JETTY_BASE}/chef-solo/cookbooks/ +ADD --chown=jetty:jetty onboarding-be-*.war ${JETTY_BASE}/webapps/ +ADD --chown=jetty:jetty api-docs.war ${JETTY_BASE}/webapps/ +COPY --chown=jetty:jetty startup.sh ${JETTY_BASE}/ RUN chmod 770 ${JETTY_BASE}/startup.sh -ENTRYPOINT ${JETTY_BASE}/startup.sh +ENTRYPOINT [ "sh", "-c", "${JETTY_BASE}/startup.sh"] diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh index df8cefbd85..cf1b6227ad 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh @@ -1,10 +1,9 @@ #!/bin/sh - cd /var/lib/jetty/chef-solo chef-solo -c solo.rb -E ${ENVNAME} rc=$? -if [[ $rc != 0 ]]; then +if [ $rc -ne 0 ]; then echo "Chef exaction failed." exit $rc; fi @@ -19,6 +18,4 @@ JAVA_OPTIONS=" ${JAVA_OPTIONS} \ cd /var/lib/jetty -/docker-entrypoint.sh & - -while true; do sleep 2; done +java $JAVA_OPTIONS -jar "$JETTY_HOME/start.jar" -- cgit 1.2.3-korg