forked from 5nafu/docker-freenet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
64 lines (49 loc) · 2.25 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM debian:stable-slim
LABEL maintainer="Chris Bensch <[email protected]>"
# Original Credit - "Tobias Vollmer <[email protected]>"
ARG darknetport=8675 opennetport=8676
ENV DEBIAN_FRONTEND=noninteractive
RUN mkdir -p /usr/share/man/man1 /usr/share/man/man2
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget \
openjdk-17-jre-headless \
openssl \
&& ln -s /lib /lib64 \
&& mkdir -p /conf /data \
#&& addgroup --system --gid 1000 fred \
#&& adduser --system --uid 1000 --home /fred fred \
&&adduser --system --group --home /fred fred \
&& chown -R fred:fred /conf /data
COPY defaults/freenet.ini /defaults/freenet.ini
COPY defaults/freenet.ini /conf/freenet.ini
COPY docker-run /fred/
#RUN chown fred:fred /fred/freenet.ini && chmod 755 /fred/freenet.ini
USER fred
WORKDIR /fred
COPY defaults/seednodes.fref /fred/
COPY defaults/openpeers-2332 /fred/
# Get the latest freenet build or use supplied version
RUN build=$(test -n "${freenet_build}" && echo ${freenet_build} \
|| wget -qO - https://api.github.com/repos/freenet/fred/releases/latest | grep 'tag_name'| cut -d'"' -f 4) \
&& short_build=$(echo ${build}|cut -c7-) \
&& echo -e "build: $build\nurl: https://github.com/freenet/fred/releases/download/$build/new_installer_offline_$short_build.jar" >buildinfo.json \
&& echo "Building:" \
&& cat buildinfo.json
# Download and install freenet in the given version
RUN wget -O /tmp/new_installer.jar $(grep url /fred/buildinfo.json |cut -d" " -f2) \
&& echo "INSTALL_PATH=/fred/" >/tmp/install_options.conf \
&& java -jar /tmp/new_installer.jar -options /tmp/install_options.conf \
&& sed -i 's#wrapper.app.parameter.1=freenet.ini#wrapper.app.parameter.1=/fred/freenet.ini#' /fred/wrapper.conf \
&& rm /tmp/new_installer.jar /tmp/install_options.conf \
&& echo "Build successful" \
&& echo "----------------" \
&& cat /fred/buildinfo.json
COPY defaults/freenet.ini /fred/
# Check every 5 Minutes, if Freenet is still running
HEALTHCHECK --interval=5m --timeout=3s CMD /fred/run.sh status || exit 1
# Interfaces:
EXPOSE 8888 9481 ${darknetport}/udp ${opennetport}/udp
VOLUME ["/conf", "/data"]
# Command to run on start of the container
CMD [ "/fred/docker-run" ]