source: Dockerfile @ 7e6a92a

Last change on this file since 7e6a92a was 7f9a211, checked in by meeh <meeh@…>, 3 years ago

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

  • Property mode set to 100644
File size: 2.4 KB
Line 
1FROM meeh/java8server:latest
2# Docker image based on Alpine with Java.
3
4# We use Oracle Java to run I2P, but uses the openjdk to build it.
5
6
7MAINTAINER Mikal Villa <mikal@sigterm.no>
8
9ENV GIT_BRANCH="master"
10ENV I2P_PREFIX="/opt/i2p"
11ENV PATH=${I2P_PREFIX}/bin:$PATH
12ENV JAVA_HOME=/usr/lib/jvm/default-jvm
13
14ENV GOSU_VERSION=1.7
15ENV GOSU_SHASUM="34049cfc713e8b74b90d6de49690fa601dc040021980812b2f1f691534be8a50  /usr/local/bin/gosu"
16
17RUN mkdir /user && adduser -S -h /user i2p && chown -R i2p:nobody /user
18
19# Adding files first, since Docker.expt is required for installation
20ADD Docker.expt /tmp/Docker.expt
21ADD Docker.entrypoint.sh /entrypoint.sh
22
23# Required for wget https
24RUN apk add --no-cache openssl
25# Gosu is a replacement for su/sudo in docker and not a backdoor :) See https://github.com/tianon/gosu
26RUN wget -O /usr/local/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64 \
27    && echo "${GOSU_SHASUM}" | sha256sum -c && chmod +x /usr/local/bin/gosu
28
29#
30# Each RUN is a layer, adding the dependencies and building i2pd in one layer takes around 8-900Mb, so to keep the
31# image under 200mb we need to remove all the build dependencies in the same "RUN" / layer.
32#
33
34# The main layer
35RUN apk --no-cache add build-base git gettext tar bzip2 apache-ant openjdk8 expect \
36    && mkdir -p /usr/src/build \
37    && cd /usr/src/build \
38    && git clone -b ${GIT_BRANCH} https://github.com/i2p/i2p.i2p.git \
39    && cd /usr/src/build/i2p.i2p \
40    && echo "noExe=true" >> build.properties \
41    && ant installer-linux \
42    && cp i2pinstall*.jar /tmp/i2pinstall.jar \
43    && mkdir -p /opt \
44    && chown i2p:root /opt \
45    && chmod u+rw /opt \
46    && gosu i2p expect -f /tmp/Docker.expt \
47    && cd ${I2P_PREFIX} \
48    && rm -fr man docs *.bat *.command *.app /tmp/i2pinstall.jar /tmp/Docker.expt \
49    && rm -fr /usr/src/build \
50    && apk --purge del build-base apache-ant expect tcl expat git openjdk8 openjdk8-jre openjdk8-jre-base openjdk8-jre-lib bzip2 tar \
51      binutils-libs binutils pkgconfig libcurl libc-dev musl-dev g++ make fortify-headers pkgconf giflib libssh2 libxdmcp libxcb \
52      libx11 pcre alsa-lib libxi libxrender libxml2 readline bash openssl \
53    && rm -fr /usr/lib/jvm/default-jre \
54    && ln -sf /opt/jdk/jre /usr/lib/jvm/default-jre \
55    && chmod a+x /entrypoint.sh
56
57
58
59EXPOSE 7654 7656 7657 7658 4444 6668 8998 7659 7660 4445 15000-20000
60
61ENTRYPOINT [ "/entrypoint.sh" ]
62
Note: See TracBrowser for help on using the repository browser.