Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Optimize autobuild

Michal Rutkabf1c3d742ed3
diff --git a/Dockerfile b/Dockerfile
index ad856a5b1..55b4efdf3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,83 +1,4 @@
-FROM debian:stretch
+FROM openremote/autobuild:latest
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
-
-############ EDITS ABOVE THIS LINE SHOULD BE DONE IN ALL DOCKERFILES! ################
-
-# Install Docker client
-RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
-RUN add-apt-repository \
- "deb [arch=amd64] https://download.docker.com/linux/debian \
- $(lsb_release -cs) \
- stable"
-RUN apt-get update && apt-get install -y --no-install-recommends \
- docker-ce docker-ce-cli containerd.io \
- && rm -rf /var/lib/apt/lists/*
-
-# Install Docker Compose executable
-RUN curl -L https://github.com/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m` \
- -o /usr/local/bin/docker-compose && \
- chmod +x /usr/local/bin/docker-compose
-
-# Install NodeJS 10 and Yarn
-RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
- apt-get install -y nodejs && \
- npm install --global yarn
-
WORKDIR /openremote
\ No newline at end of file
diff --git a/autobuild/Dockerfile b/autobuild/Dockerfile
new file mode 100644
index 000000000..ad856a5b1
--- /dev/null
+++ b/autobuild/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
+
+############ EDITS ABOVE THIS LINE SHOULD BE DONE IN ALL DOCKERFILES! ################
+
+# Install Docker client
+RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
+RUN add-apt-repository \
+ "deb [arch=amd64] https://download.docker.com/linux/debian \
+ $(lsb_release -cs) \
+ stable"
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ docker-ce docker-ce-cli containerd.io \
+ && rm -rf /var/lib/apt/lists/*
+
+# Install Docker Compose executable
+RUN curl -L https://github.com/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m` \
+ -o /usr/local/bin/docker-compose && \
+ chmod +x /usr/local/bin/docker-compose
+
+# Install NodeJS 10 and Yarn
+RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
+ apt-get install -y nodejs && \
+ npm install --global yarn
+
+WORKDIR /openremote
\ No newline at end of file