diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..96193148bf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,47 @@ +FROM java:7-jdk as builder +# Multi stage build - https://docs.docker.com/engine/userguide/eng-image/multistage-build/ + +# install maven +RUN apt-get update && apt-get install -y --no-install-recommends maven + +# build and extract deegree +RUN mkdir /build && mkdir /target +COPY ./ /build/ +RUN cd /build/ && \ + mvn clean install -DskipTests && \ + cp /build/deegree-services/deegree-webservices/target/deegree-webservices-*.war /build/deegree-webservices.war && \ + unzip -o /build/deegree-webservices.war -d /target + +# add to image... +FROM tomcat:8.0-jre7 +ENV LANG en_US.UTF-8 + +# add build info - see hooks/build and http://label-schema.org/ +ARG BUILD_DATE +ARG VCS_REF +ARG VCS_URL +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.vcs-url=$VCS_URL \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.schema-version="1.0.0-rc1" + +EXPOSE 8080 + +# set default secrets ( override for production use! ) +# consoleSecretKey="deegree" +ENV consoleSecretKey=000001544E797221:564344F65B8F9DDBA6A410E461E7801E10955F56D8679284966F400C68B6CEAB +ENV apiUser=deegree +ENV apiPass=deegree + +RUN mkdir /root/.deegree && \ + rm -r /usr/local/tomcat/webapps/ROOT + +COPY --from=builder /target /usr/local/tomcat/webapps/ROOT + +#cmd: +# 1. configure deegreeapi access +# 2. configure console access +# 3. start tomcat +CMD sed -i '44i /' /usr/local/tomcat/conf/tomcat-users.xml \ + && echo $consoleSecretKey >/root/.deegree/console.pw \ + && /usr/local/tomcat/bin/catalina.sh run diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..07c1db3164 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +# simple compose file for running the Docker image +deegree: + build: . + ports: + - "8080:8080" diff --git a/hooks/build b/hooks/build new file mode 100644 index 0000000000..f15293185d --- /dev/null +++ b/hooks/build @@ -0,0 +1,17 @@ +#!/bin/bash + +# see https://medium.com/microscaling-systems/labelling-automated-builds-on-docker-hub-f3d073fb8e1 +# and https://docs.docker.com/docker-cloud/builds/advanced/#override-build-test-or-push-commands + +# $IMAGE_NAME var is injected into the build so the tag is correct. + +echo "Build hook running" +docker build \ + --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ + --build-arg VCS_REF=`git rev-parse HEAD` \ + --build-arg VCS_URL=`git ls-remote --get-url origin` \ + -t $IMAGE_NAME . + +# Other options for getting VCS URL: +# git remote get-url origin # seems to be not available on Docker Hub +# git config --get remote.origin.url diff --git a/pom.xml b/pom.xml index ac450f416a..5d9be36432 100644 --- a/pom.xml +++ b/pom.xml @@ -26,9 +26,22 @@ true + + + wetransform-repo + https://artifactory.wetransform.to/artifactory/deegree + + never + + + false + + + apidoc.deegree.org file:///tmp/site/${project.version}/ + + wetf-releases + https://artifactory.wetransform.to/artifactory/deegree-release-local + + + wetf-snapshots + https://artifactory.wetransform.to/artifactory/deegree-snapshot-local +