Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Busybox+Oracle Java 8 - below 240MB size #1

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
FROM debian:7.8
FROM jeanblanchard/busybox-java:8
MAINTAINER Mike Babineau [email protected]

ENV \
ZK_RELEASE="http://www.apache.org/dist/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz" \
EXHIBITOR_POM="https://raw.githubusercontent.com/Netflix/exhibitor/d911a16d704bbe790d84bbacc655ef050c1f5806/exhibitor-standalone/src/main/resources/buildscripts/standalone/maven/pom.xml" \
# Append "+" to ensure the package doesn't get purged
BUILD_DEPS="curl maven openjdk-7-jdk+" \
DEBIAN_FRONTEND="noninteractive"
MVN_RELEASE="http://www.apache.org/dist/maven/maven-3/3.3.1/binaries/apache-maven-3.3.1-bin.tar.gz"

# Use one step so we can remove intermediate dependencies and minimize size
RUN \
# Install dependencies
apt-get update \
&& apt-get install -y --no-install-recommends $BUILD_DEPS \
opkg-install bash tar \

# Default DNS cache TTL is -1. DNS records, like, change, man.
&& grep '^networkaddress.cache.ttl=' /etc/java-7-openjdk/security/java.security || echo 'networkaddress.cache.ttl=60' >> /etc/java-7-openjdk/security/java.security \
&& grep -q '^networkaddress.cache.ttl=' /opt/jdk/jre/lib/security/java.security || echo 'networkaddress.cache.ttl=60' >> /opt/jdk/jre/lib/security/java.security \

# Install ZK
&& curl -Lo /tmp/zookeeper.tgz $ZK_RELEASE \
&& mkdir -p /opt/zookeeper/transactions /opt/zookeeper/snapshots \
&& tar -xzf /tmp/zookeeper.tgz -C /opt/zookeeper --strip=1 \
&& rm /tmp/zookeeper.tgz \

# Install Maven (just for building)
&& mkdir -p /opt/maven \
&& curl -Lo /tmp/maven.tgz $MVN_RELEASE \
&& tar -xzf /tmp/maven.tgz -C /opt/maven --strip=1 \
&& rm /tmp/maven.tgz \

# Install Exhibitor
&& mkdir -p /opt/exhibitor \
&& curl -Lo /opt/exhibitor/pom.xml $EXHIBITOR_POM \
&& mvn -f /opt/exhibitor/pom.xml package \
&& curl -kLo /opt/exhibitor/pom.xml $EXHIBITOR_POM \
&& /opt/maven/bin/mvn -f /opt/exhibitor/pom.xml package \
&& ln -s /opt/exhibitor/target/exhibitor*jar /opt/exhibitor/exhibitor.jar \

# Remove build-time dependencies
&& apt-get purge -y --auto-remove $BUILD_DEPS \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf ~/.m2 \
&& rm -rf ~/opt/maven \
&& opkg-cl remove tar bzip2 libbz2 libacl libattr\
&& rm -rf /tmp/*

# Add the wrapper script to setup configs and exec exhibitor
ADD include/wrapper.sh /opt/exhibitor/wrapper.sh
Expand All @@ -43,4 +48,7 @@ USER root
WORKDIR /opt/exhibitor
EXPOSE 2181 2888 3888 8181

ENTRYPOINT ["bash", "-ex", "/opt/exhibitor/wrapper.sh"]
VOLUME /opt/zookeeper/transactions
VOLUME /opt/zookeeper/snapshots

ENTRYPOINT ["bash", "-ex", "/opt/exhibitor/wrapper.sh"]