Skip to content

armgit / core

Public Imported from GitHub
0

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

Running docker client inside container

Christian Bauer56f5f94e7231
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..4615553c8
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,5 @@
+**/.git
+**/.gradle
+**/.idea
+**/.node
+**/.vagrant
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..c117a84d5
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,82 @@
+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
+
+ENV JAVA_VERSION 8u181
+ENV JAVA_DEBIAN_VERSION 8u181-b13-2~deb9u1
+
+# see https://bugs.debian.org/775775
+# and https://github.com/docker-library/java/issues/19#issuecomment-70546872
+# and https://packages.debian.org/stretch/ca-certificates-java
+# TODO This seems to be fixed now?
+#ENV CA_CERTIFICATES_JAVA_VERSION 20170929~deb9u1
+
+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="$JAVA_DEBIAN_VERSION" \
+ 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'
+
+# see CA_CERTIFICATES_JAVA_VERSION notes above
+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
+
+ENV JAVA_OPTS -Xmx1g
+
+# 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/*
+
+ENTRYPOINT docker ps -a
\ No newline at end of file