I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 7f9a2112 authored by meeh's avatar meeh
Browse files

Adding Dockerfile with support files to build a minimal docker image running i2p.

parent fc0ddb01
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
export JAVA_HOME=/opt/jdk/jre
# Ensure user rights
chown -R i2p:nobody /opt/i2p
chmod -R u+rwx /opt/i2p
gosu i2p /opt/i2p/i2psvc /opt/i2p/wrapper.config wrapper.pidfile=/var/tmp/i2p.pid \
wrapper.name=i2p \
wrapper.displayname="I2P Service" \
wrapper.statusfile=/var/tmp/i2p.status \
wrapper.java.statusfile=/var/tmp/i2p.java.status \
wrapper.logfile=/var/tmp/wrapper.log
#!/usr/bin/expect
set timeout 15;
spawn java -jar /tmp/i2pinstall.jar -console
expect {
-re ".*press 1 to continue, 2 to quit, 3 to redisplay" {send "1\r"; exp_continue;}
-re "Select target path *" {send "/opt/i2p\r"; exp_continue;}
}
FROM meeh/java8server:latest
# Docker image based on Alpine with Java.
# We use Oracle Java to run I2P, but uses the openjdk to build it.
MAINTAINER Mikal Villa <mikal@sigterm.no>
ENV GIT_BRANCH="master"
ENV I2P_PREFIX="/opt/i2p"
ENV PATH=${I2P_PREFIX}/bin:$PATH
ENV JAVA_HOME=/usr/lib/jvm/default-jvm
ENV GOSU_VERSION=1.7
ENV GOSU_SHASUM="34049cfc713e8b74b90d6de49690fa601dc040021980812b2f1f691534be8a50 /usr/local/bin/gosu"
RUN mkdir /user && adduser -S -h /user i2p && chown -R i2p:nobody /user
# Adding files first, since Docker.expt is required for installation
ADD Docker.expt /tmp/Docker.expt
ADD Docker.entrypoint.sh /entrypoint.sh
# Required for wget https
RUN apk add --no-cache openssl
# Gosu is a replacement for su/sudo in docker and not a backdoor :) See https://github.com/tianon/gosu
RUN wget -O /usr/local/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64 \
&& echo "${GOSU_SHASUM}" | sha256sum -c && chmod +x /usr/local/bin/gosu
#
# Each RUN is a layer, adding the dependencies and building i2pd in one layer takes around 8-900Mb, so to keep the
# image under 200mb we need to remove all the build dependencies in the same "RUN" / layer.
#
# The main layer
RUN apk --no-cache add build-base git gettext tar bzip2 apache-ant openjdk8 expect \
&& mkdir -p /usr/src/build \
&& cd /usr/src/build \
&& git clone -b ${GIT_BRANCH} https://github.com/i2p/i2p.i2p.git \
&& cd /usr/src/build/i2p.i2p \
&& echo "noExe=true" >> build.properties \
&& ant installer-linux \
&& cp i2pinstall*.jar /tmp/i2pinstall.jar \
&& mkdir -p /opt \
&& chown i2p:root /opt \
&& chmod u+rw /opt \
&& gosu i2p expect -f /tmp/Docker.expt \
&& cd ${I2P_PREFIX} \
&& rm -fr man docs *.bat *.command *.app /tmp/i2pinstall.jar /tmp/Docker.expt \
&& rm -fr /usr/src/build \
&& apk --purge del build-base apache-ant expect tcl expat git openjdk8 openjdk8-jre openjdk8-jre-base openjdk8-jre-lib bzip2 tar \
binutils-libs binutils pkgconfig libcurl libc-dev musl-dev g++ make fortify-headers pkgconf giflib libssh2 libxdmcp libxcb \
libx11 pcre alsa-lib libxi libxrender libxml2 readline bash openssl \
&& rm -fr /usr/lib/jvm/default-jre \
&& ln -sf /opt/jdk/jre /usr/lib/jvm/default-jre \
&& chmod a+x /entrypoint.sh
EXPOSE 7654 7656 7657 7658 4444 6668 8998 7659 7660 4445 15000-20000
ENTRYPOINT [ "/entrypoint.sh" ]
Just to trigger automatic builds of docker image.
Sorry for the mess in the root directory.
TODO: Change content :)
(hub.docker.io requires a Dockerfile + README.md in root, to build from a repo)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment