From 505e9d7084e63af272f2c84839a87ae945b66eb1 Mon Sep 17 00:00:00 2001 From: ryjer Date: Sat, 16 Sep 2023 21:16:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E7=94=A8alpine=E8=80=81=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 9 ++++---- Dockerfile.default | 43 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 Dockerfile.default diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ed19a33..9339da6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ on: push: #branches: [ master ] paths: - - Dockerfile + - Dockerfile.default pull_request: branches: [ master ] @@ -51,15 +51,16 @@ jobs: uses: docker/build-push-action@v2 with: context: . - file: Dockerfile + file: Dockerfile.default platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new tags: | ryjer/opentracker:latest - ryjer/opentracker:alpine3.18 - ryjer/opentracker:alpine3.18.3 + ryjer/opentracker:alpine + ryjer/opentracker:alpine3.15 + ryjer/opentracker:alpine3.15.10 # 处理缓存无限增大问题的临时修复,以防出现问题。(等待github官方修复) #- name: Move cache diff --git a/Dockerfile.default b/Dockerfile.default new file mode 100644 index 0000000..a8b3ed8 --- /dev/null +++ b/Dockerfile.default @@ -0,0 +1,43 @@ +FROM alpine:3.15.10 as build + +WORKDIR /src +RUN apk add gcc \ + g++ \ + make \ + git \ + cvs \ + zlib-dev + +# 下载并编译 libowfat 库 +RUN cvs -d :pserver:cvs@cvs.fefe.de:/cvs -z9 co libowfat \ + && cd libowfat \ + && make + +RUN git clone git://erdgeist.org/opentracker \ + && cd opentracker \ + && make clean && make + + +FROM alpine:3.15.10 + +# XDG目录规范 +ENV XDG_CONFIG_HOME=/config + +COPY --from=build /src/opentracker/opentracker /bin/opentracker + +# 创建配置目录,安装 curl 健康检查使用 +RUN apk add --no-cache curl \ + && mkdir -p /config + +# 对外暴露配置卷路径 +VOLUME /config + +# 复制配置文件到配置路径 +COPY ./opentracker.conf /config/opentracker.conf +COPY ./whitelist /config/whitelist +COPY ./blacklist /config/blacklist + +EXPOSE 6969/tcp +EXPOSE 6969/udp + +CMD /bin/opentracker -f /config/opentracker.conf