100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Reduced swarm footprint
Michal Rutka6863f1bbd10c
diff --git a/docker-compose-swarm.yml b/docker-compose-swarm.ymlindex 2630e0332..3f15f728d 100644--- a/docker-compose-swarm.yml+++ b/docker-compose-swarm.yml@@ -30,7 +30,7 @@ networks:driver: overlaydriver_opts:encrypted: 'true'- attachable: true+ attachable: false# If you enable volume mappings in services, you need this. Otherwise, remove the volumesvolumes:@@ -55,6 +55,9 @@ services:# Image will be pulled when using the `docker-compose pull` command or `docker-compose up --no-build`image: openremote/proxy:${DATE_TAG:-latest}+ networks:+ - public+ - privateenvironment:@@ -119,8 +122,9 @@ services:manager:# Image will be pulled when using the `docker-compose pull` command or `docker-compose up --no-build`- image: openremote/manager:${DATE_TAG:-latest}- #image: swarm/manager:latest+ image: openremote/manager:${DATE_TAG:-swarm}+ networks:+ - privateenvironment:@@ -219,7 +223,10 @@ services:# Image will be pulled when using the `docker-compose pull` command or `docker-compose up --no-build`image: openremote/keycloak:${DATE_TAG:-latest}-+ networks:+ - public+ - private+environment:# It is important that all services have the same timezone and are time synchronized.@@ -271,7 +278,9 @@ services:postgresql:# Image will be pulled when using the `docker-compose pull` command or `docker-compose up --no-build`image: openremote/postgresql:${DATE_TAG:-latest}-+ networks:+ - private+environment:# It is important that all services have the same timezone and are time synchronized.diff --git a/manager/swarm.Dockerfile b/manager/swarm.Dockerfilenew file mode 100644index 000000000..559e57e3c--- /dev/null+++ b/manager/swarm.Dockerfile@@ -0,0 +1,83 @@+FROM debian:stretch+MAINTAINER [email protected]++# Install utilities+RUN apt-get update && apt-get install -y --no-install-recommends \+ apt-transport-https \+ gnupg2 \+ software-properties-common \+ procps \+ ca-certificates \+ curl \+ wget \+ && rm -rf /var/lib/apt/lists/*++# Default to UTF-8 file.encoding+ENV LANG C.UTF-8++# add a simple script that can auto-detect the appropriate JAVA_HOME value+# based on whether the JDK or only the JRE is installed+RUN { \+ echo '#!/bin/sh'; \+ echo 'set -e'; \+ echo; \+ echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \+ } > /usr/local/bin/docker-java-home \+ && chmod +x /usr/local/bin/docker-java-home++# do some fancy footwork to create a JAVA_HOME that's cross-architecture-safe+RUN ln -svT "/usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)" /docker-java-home+ENV JAVA_HOME /docker-java-home++RUN set -ex; \+ \+# deal with slim variants not having man page directories (which causes "update-alternatives" to fail)+ if [ ! -d /usr/share/man/man1 ]; then \+ mkdir -p /usr/share/man/man1; \+ fi; \+ \+ apt-get update; \+ apt-get install -y \+ openjdk-8-jdk \+ ca-certificates-java\+ ; \+ rm -rf /var/lib/apt/lists/*; \+ \+# verify that "docker-java-home" returns what we expect+ [ "$(readlink -f "$JAVA_HOME")" = "$(docker-java-home)" ]; \+ \+# update-alternatives so that future installs of other OpenJDK versions don't change /usr/bin/java+ update-alternatives --get-selections | awk -v home="$(readlink -f "$JAVA_HOME")" 'index($3, home) == 1 { $2 = "manual"; print | "update-alternatives --set-selections" }'; \+# ... and verify that it actually worked for one of the alternatives we care about+ update-alternatives --query java | grep -q 'Status: manual'++# Run postinst because it might not happen on install+RUN /var/lib/dpkg/info/ca-certificates-java.postinst configure++# Add git commit label must be specified at build time using --build-arg GIT_COMMIT=dadadadadad+ARG GIT_COMMIT=unknown+LABEL git-commit=$GIT_COMMIT++ADD lib /opt/app/lib+############ EDITS ABOVE THIS LINE SHOULD BE DONE IN ALL DOCKERFILES! ################+FROM openjdk:8-jre++ENV JAVA_OPTS -Xmx1g++ENV APP_DOCROOT /deployment/manager/app+ENV SHARED_DOCROOT /deployment/manager/shared+ENV LOGGING_CONFIG_FILE /deployment/manager/logging.properties+ENV MAP_TILES_PATH /deployment/map/mapdata.mbtiles+ENV MAP_SETTINGS_PATH /deployment/map/mapsettings.json++EXPOSE 8080++HEALTHCHECK --interval=3s --timeout=3s --start-period=2s --retries=120 CMD curl --fail --silent http://localhost:8080 || exit 1++WORKDIR /opt/app++RUN mkdir -p /deployment/extensions++COPY --from=0 /opt/app/lib /opt/app/lib++ENTRYPOINT java $JAVA_OPTS -cp /opt/app/lib/*:/deployment/manager/extensions/* org.openremote.manager.Main