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

Skip to content
Snippets Groups Projects
Commit 179b79f8 authored by Zlatin Balevsky's avatar Zlatin Balevsky Committed by idk
Browse files

Docker persistent home

parent bf6dcbce
No related branches found
No related tags found
1 merge request!27Docker persistent home
#!/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;}
}
# Use a multi-stage build to reduce the size of the resulting image FROM jlesage/baseimage:alpine-3.10-glibc
# We need alpine >v3 in order to install an apache-ant > 1.9 ENV APP_HOME="/i2p"
FROM alpine:3 as builder
ENV I2P_PREFIX="/opt/i2p"
WORKDIR /tmp/build WORKDIR /tmp/build
COPY . ./ COPY . .
# Build installer # Build package
RUN apk --no-cache add build-base gettext tar bzip2 apache-ant openjdk8 expect RUN add-pkg openjdk8-jre
RUN add-pkg --virtual build-base gettext tar bzip2 apache-ant openjdk8
RUN echo "noExe=true" >> build.properties RUN echo "noExe=true" >> build.properties
RUN ant installer-linux RUN ant clean pkg
RUN mkdir -p /opt RUN del-pkg build-base gettext tar bzip2 apache-ant openjdk8
RUN mv i2pinstall*.jar /tmp/i2pinstall.jar
# Install i2p using the installer into I2P_PREFIX # "install" files
RUN expect -f ./Docker.expt RUN mkdir -p ${APP_HOME}
RUN cd ${I2P_PREFIX} RUN mv pkg-temp/* ${APP_HOME}
RUN rm -fr man docs *.bat *.command *.app
# Second stage only using the installer from the last stage
# ---------------------------------------------------------
# We can't use alpine here as the java service wrapper is built with glibc
# alpine uses musl
FROM openjdk:11.0-jre-slim
ARG I2P_UID=1000
ARG I2P_USER=i2p
ENV I2P_PREFIX="/opt/i2p"
ENV PATH=${I2P_PREFIX}/bin:$PATH
# "install" i2p by copying over installed files # "install" i2p by copying over installed files
COPY --from=builder /opt/i2p ${I2P_PREFIX} COPY docker/rootfs/ /
COPY docker/* /opt/i2p/
# Setup user and fix permissions in # Mount home
RUN adduser --system --uid ${I2P_UID} --home /user ${I2P_USER} \ VOLUME ["${APP_HOME}/.i2p"]
&& chown -R ${I2P_USER} /user \
&& chown -R ${I2P_USER} ${I2P_PREFIX} \
&& chmod -R u+rwx ${I2P_PREFIX}
EXPOSE 7654 7656 7657 7658 4444 6668 8998 7659 7660 4445 EXPOSE 7654 7656 7657 7658 4444 6668 8998 7659 7660 4445
USER i2p # Metadata.
ENTRYPOINT [ "/opt/i2p/i2psvc" ] LABEL \
CMD [ "/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" ] org.label-schema.name="i2p" \
org.label-schema.description="Docker container for I2P" \
org.label-schema.version="1.0" \
org.label-schema.vcs-url="https://github.com/i2p/i2p.i2p" \
org.label-schema.schema-version="1.0"
#!/usr/bin/with-contenv sh
#
# Add the app user to the password and group databases. This is needed just to
# make sure that mapping between the user/group ID and its name is possible.
#
set -e # Exit immediately if a command exits with a non-zero status.
set -u # Treat unset variables as an error.
cp /defaults/passwd /etc/passwd
cp /defaults/group /etc/group
cp /defaults/shadow /etc/shadow
chown root:shadow /etc/shadow
chmod 640 /etc/shadow
echo "$APP_USER:x:$USER_ID:$GROUP_ID::${APP_HOME:-/dev/null}:/sbin/nologin" >> /etc/passwd
echo "$APP_USER:x:$GROUP_ID:" >> /etc/group
# Make sure APP_HOME is editable by the user
if [[ -n "$APP_HOME" ]] ; then
chown -R "$APP_USER" "$APP_HOME"
chmod -R u+rw "$APP_HOME"
fi
# vim:ft=sh:ts=4:sw=4:et:sts=4
File moved
File moved
#!/bin/sh
set -e
# Explicitly define HOME otherwise it might not have been set
export HOME=/i2p
export I2P=${HOME}/i2p
echo "Starting I2P"
cd $HOME
export CLASSPATH=.
for jar in `ls lib/*.jar`; do
CLASSPATH=${CLASSPATH}:${jar}
done
JAVAOPTS="-Djava.net.preferIPv4Stack=false -Djava.library.path=${I2P}:${I2P}/lib -Di2p.dir.base=${I2P} -Di2p.dir.config=${HOME}/.i2p -DloggerFilenameOverride=logs/log-router-@.txt"
java -cp "${CLASSPATH}" ${JAVA_OPTS} net.i2p.router.RouterLaunch
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