From 9dd8cd771caa132f10ad8dcb6dab029b469bcddf Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 26 Apr 2020 12:31:19 +0200 Subject: [PATCH] added packaging for docker --- scm-packaging/docker/Dockerfile | 43 ++++ scm-packaging/docker/pom.xml | 166 +++++++++++++++ .../docker/src/main/fs/etc/scm/logging.xml | 84 ++++++++ .../src/main/fs/etc/scm/server-config.xml | 193 ++++++++++++++++++ .../scm-server/var/webapp/docroot/index.html | 35 ++++ scm-packaging/pom.xml | 1 + 6 files changed, 522 insertions(+) create mode 100644 scm-packaging/docker/Dockerfile create mode 100644 scm-packaging/docker/pom.xml create mode 100644 scm-packaging/docker/src/main/fs/etc/scm/logging.xml create mode 100644 scm-packaging/docker/src/main/fs/etc/scm/server-config.xml create mode 100644 scm-packaging/docker/src/main/fs/opt/scm-server/var/webapp/docroot/index.html diff --git a/scm-packaging/docker/Dockerfile b/scm-packaging/docker/Dockerfile new file mode 100644 index 0000000000..558222631f --- /dev/null +++ b/scm-packaging/docker/Dockerfile @@ -0,0 +1,43 @@ +# +# MIT License +# +# Copyright (c) 2020-present Cloudogu GmbH and Contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +FROM adoptopenjdk/openjdk11:jdk-11.0.7_10-alpine-slim +ENV SCM_HOME=/var/lib/scm +ENV CACHE_DIR=/var/cache/scm/work + +COPY . / + +RUN set -x \ + && apk add --no-cache mercurial bash \ + && addgroup -S -g 1000 scm \ + && adduser -S -s /bin/false -G scm -h ${SCM_HOME} -D -H -u 1000 scm \ + && mkdir -p ${SCM_HOME} ${CACHE_DIR} \ + && chown scm:scm ${SCM_HOME} ${CACHE_DIR} + +WORKDIR "/opt/scm-server" +VOLUME ["${SCM_HOME}", "${CACHE_DIR}"] +EXPOSE 8080 +USER scm + +CMD [ "java", "-cp", "/etc/scm:/opt/scm-server/lib/*", "-Djava.awt.headless=true", "-Dlogback.configurationFile=logging.xml", "sonia.scm.server.ScmServerDaemon" ] diff --git a/scm-packaging/docker/pom.xml b/scm-packaging/docker/pom.xml new file mode 100644 index 0000000000..62984ad60b --- /dev/null +++ b/scm-packaging/docker/pom.xml @@ -0,0 +1,166 @@ + + + + + 4.0.0 + + + sonia.scm.packaging + scm-packaging + 2.0.0-SNAPSHOT + + + docker + pom + 2.0.0-SNAPSHOT + + + + + sonia.scm + scm-server + ${project.version} + + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.1.0 + + + copy-dockerfile + prepare-package + + copy-resources + + + + ${project.build.directory}/build + + + . + + Dockerfile + + false + + + + + + + copy-sources + prepare-package + + copy-resources + + + + ${project.build.directory}/build + + + src/main/fs + false + + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.2 + + + copy-server + prepare-package + + copy-dependencies + + + runtime + ${project.build.directory}/build/opt/scm-server/lib + false + false + true + + + + copy-webapp + prepare-package + + copy + + + + + sonia.scm + scm-webapp + ${project.version} + war + ${project.build.directory}/build/opt/scm-server/var/webapp + scm-webapp.war + + + + + + + + + com.spotify + dockerfile-maven-plugin + 1.4.13 + + + default + package + + build + + + + + docker.io/scmmanager/scm-manager + ${project.version} + target/build + + + + + + + diff --git a/scm-packaging/docker/src/main/fs/etc/scm/logging.xml b/scm-packaging/docker/src/main/fs/etc/scm/logging.xml new file mode 100644 index 0000000000..bc0f6fc1b4 --- /dev/null +++ b/scm-packaging/docker/src/main/fs/etc/scm/logging.xml @@ -0,0 +1,84 @@ + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%-10X{transaction_id}] %-5level %logger - %msg%n + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scm-packaging/docker/src/main/fs/etc/scm/server-config.xml b/scm-packaging/docker/src/main/fs/etc/scm/server-config.xml new file mode 100644 index 0000000000..b7a5a7efef --- /dev/null +++ b/scm-packaging/docker/src/main/fs/etc/scm/server-config.xml @@ -0,0 +1,193 @@ + + + + + + + + 16384 + 16384 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /scm + + /var/webapp/scm-webapp.war + + + org.eclipse.jetty.servlet.Default.dirAllowed + false + + /var/cache/scm/work/webapp + + + + / + + + + + + /var/webapp/docroot + + + + + /var/cache/scm/work/work/docroot + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scm-packaging/docker/src/main/fs/opt/scm-server/var/webapp/docroot/index.html b/scm-packaging/docker/src/main/fs/opt/scm-server/var/webapp/docroot/index.html new file mode 100644 index 0000000000..a3bff3f8b3 --- /dev/null +++ b/scm-packaging/docker/src/main/fs/opt/scm-server/var/webapp/docroot/index.html @@ -0,0 +1,35 @@ + + + + + SCM-Server + + + + + + diff --git a/scm-packaging/pom.xml b/scm-packaging/pom.xml index 69f40c26e3..586a2a3092 100644 --- a/scm-packaging/pom.xml +++ b/scm-packaging/pom.xml @@ -43,6 +43,7 @@ rpm deb unix + docker