Initial commit

This commit is contained in:
椰子 2024-10-30 23:27:59 +08:00
commit 4c70bd3fe4
2 changed files with 45 additions and 0 deletions

37
Dockerfile Normal file
View File

@ -0,0 +1,37 @@
FROM alpine as builder
RUN apk add git cvs make gcc g++ musl-dev zlib-dev
# 下载依赖库 libowfat 和 opentracker设置 opentracker 特性不公开详细信息、允许通告ip、关闭fullscrape、允许代理ip
RUN set -ex; cvs -d :pserver:cvs@cvs.fefe.de:/cvs -z9 co libowfat; \
cd libowfat; \
make ${nproc}; \
cd ..;
RUN set -ex; git clone git://erdgeist.org/opentracker; \
cd opentracker; \
sed -i '/FEATURES+=-DWANT_RESTRICT_STATS$/s/^#/#/' Makefile; \
sed -i '/FEATURES+=-DWANT_IP_FROM_QUERY_STRING$/s/^#//' Makefile; \
sed -i '/^FEATURES+=-DWANT_FULLSCRAPE$/s/^//' Makefile; \
sed -i '/^FEATURES+=-DWANT_IP_FROM_PROXY$/s/^#//' Makefile; \
make -j ${nrpoc};
FROM alpine
LABEL maintainer="Yezzi Hsueh <xueye404@gmail.com>"
ENV XDG_CONFIG_HOME=/config
VOLUME ["$XDG_CONFIG_HOME"]
EXPOSE 6969/tcp
EXPOSE 6969/udp
COPY --from=builder opentracker/opentracker /bin/opentracker
COPY --from=builder opentracker/opentracker.conf.sample /etc/opentracker/opentracker.conf.sample
COPY entrypoint.sh /entrypoint.sh
RUN mkdir -p $XDG_CONFIG_HOME && chmod 755 /entrypoint.sh
ENTRYPOINT ["/bin/sh", "-c", "/entrypoint.sh"]

8
entrypoint.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh
if [ ! -f "$XDG_CONFIG_HOME/opentracker.conf" ]; then
cp -a /etc/opentracker/opentracker.conf.sample $XDG_CONFIG_HOME/opentracker.conf
fi
/bin/opentracker -f $XDG_CONFIG_HOME/opentracker.conf