docker – Blame information for rev 42
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
42 | office | 1 | # |
2 | # Copyright (c) 2017-2022, The PurpleI2P Project |
||
3 | # |
||
4 | # This file is part of Purple i2pd project and licensed under BSD3 |
||
5 | # |
||
6 | # See full license text in LICENSE file at top of project tree |
||
7 | # |
||
8 | |||
9 | FROM alpine:latest |
||
10 | LABEL authors="Mikal Villa <mikal@sigterm.no>, Darknet Villain <supervillain@riseup.net>" |
||
11 | LABEL maintainer="Wizardry and Steamworks <wizardry.steamworks@outlook.com>" |
||
12 | |||
13 | LABEL org.opencontainers.image.source=https://github.com/PurpleI2P/i2pd |
||
14 | LABEL org.opencontainers.image.documentation=https://i2pd.readthedocs.io/en/latest/ |
||
15 | LABEL org.opencontainers.image.licenses=BSD3 |
||
16 | |||
17 | # Build arguments |
||
18 | #ARG DISTCC_HOSTS="docker.internal:35001 docker.internal:35002 docker.internal:35003 docker.internal:35004" |
||
19 | #ARG CC="distcc" |
||
20 | #ARG CXX="distcc g++" |
||
21 | ARG COMPILE_JOBS=2 |
||
22 | |||
23 | # Expose git branch, tag and URL variables as arguments |
||
24 | ARG GIT_BRANCH="openssl" |
||
25 | ENV GIT_BRANCH=${GIT_BRANCH} |
||
26 | ARG GIT_TAG="" |
||
27 | ENV GIT_TAG=${GIT_TAG} |
||
28 | ARG REPO_URL="https://github.com/PurpleI2P/i2pd.git" |
||
29 | ENV REPO_URL=${REPO_URL} |
||
30 | |||
31 | ENV I2PD_HOME="/home/i2pd" |
||
32 | ENV DATA_DIR="${I2PD_HOME}/data" |
||
33 | ENV DEFAULT_ARGS=" --datadir=$DATA_DIR" |
||
34 | |||
35 | RUN mkdir -p "$I2PD_HOME" "$DATA_DIR" \ |
||
36 | && adduser -S -h "$I2PD_HOME" i2pd \ |
||
37 | && chown -R i2pd:nobody "$I2PD_HOME" |
||
38 | |||
39 | |||
40 | # 1. Building binary |
||
41 | # Each RUN is a layer, adding the dependencies and building i2pd in one layer takes around 8-900Mb, so to keep the |
||
42 | # image under 20mb we need to remove all the build dependencies in the same "RUN" / layer. |
||
43 | # |
||
44 | # 1. install deps, clone and build. |
||
45 | # 2. strip binaries. |
||
46 | # 3. Purge all dependencies and other unrelated packages, including build directory. |
||
47 | |||
48 | |||
49 | RUN apk update \ |
||
50 | && apk --no-cache --virtual build-dependendencies add make gcc g++ libtool zlib-dev boost-dev build-base openssl-dev openssl miniupnpc-dev git boost-date_time boost-filesystem boost-chrono boost-program_options distcc \ |
||
51 | && mkdir -p /tmp/build \ |
||
52 | && cd /tmp/build && git clone -b ${GIT_BRANCH} ${REPO_URL} \ |
||
53 | && cd i2pd \ |
||
54 | && if [ -n "${GIT_TAG}" ]; then git checkout tags/${GIT_TAG}; fi \ |
||
55 | && make -j${COMPILE_JOBS} USE_UPNP=yes \ |
||
56 | && cp -R contrib/certificates /i2pd_certificates \ |
||
57 | && mkdir -p /usr/local/bin \ |
||
58 | && mv i2pd /usr/local/bin \ |
||
59 | && cd /usr/local/bin \ |
||
60 | && strip i2pd \ |
||
61 | && rm -fr /tmp/build \ |
||
62 | && mkdir -p /tmp/build \ |
||
63 | && cd /tmp/build && git clone --recursive https://github.com/PurpleI2P/i2pd-tools \ |
||
64 | && cd i2pd-tools \ |
||
65 | && git submodule init && git submodule update && git submodule update --init && git pull --recurse-submodules \ |
||
66 | && make -j${COMPILE_JOBS} \ |
||
67 | && cp b33address offlinekeys keyinfo regaddr vain x25519 regaddr_3ld famtool i2pbase64 regaddralias keygen verifyhost routerinfo /usr/local/bin \ |
||
68 | && cd /usr/local/bin \ |
||
69 | && strip b33address offlinekeys keyinfo regaddr vain x25519 regaddr_3ld famtool i2pbase64 regaddralias keygen verifyhost routerinfo \ |
||
70 | && rm -fr /tmp/build \ |
||
71 | && apk --no-cache --purge del build-dependendencies build-base fortify-headers boost-dev zlib-dev openssl-dev \ |
||
72 | miniupnpc-dev boost-python3 python3 gdbm boost-unit_test_framework linux-headers boost-prg_exec_monitor \ |
||
73 | boost-serialization boost-wave boost-wserialization boost-math boost-graph boost-regex git pcre2 \ |
||
74 | libtool g++ gcc boost-date_time boost-filesystem boost-chrono boost-program_options |
||
75 | |||
76 | # 2. Adding required libraries to run i2pd to ensure it will run. |
||
77 | RUN apk --no-cache add boost-filesystem boost-system boost-program_options boost-date_time boost-thread boost-iostreams openssl miniupnpc musl-utils libstdc++ |
||
78 | |||
79 | # 3. Copy preconfigured config file and entrypoint |
||
80 | COPY i2pd-docker.conf "$DATA_DIR/i2pd.conf" |
||
81 | RUN chown i2pd:nobody "$DATA_DIR/i2pd.conf" |
||
82 | COPY entrypoint.sh /entrypoint.sh |
||
83 | RUN chmod a+x /entrypoint.sh |
||
84 | |||
85 | RUN echo "export DATA_DIR=${DATA_DIR}" >> /etc/profile |
||
86 | VOLUME "$DATA_DIR" |
||
87 | EXPOSE 7070 4444 4447 7656 2827 7654 7650 |
||
88 | USER i2pd |
||
89 | |||
90 | ENTRYPOINT [ "/entrypoint.sh" ] |