maohaodong commited on
Commit ·
cf453fc
1
Parent(s): b8cf439
chore(docker): 简化Dockerfile使用基础镜像
Browse files- 删除复杂的多阶段构建过程和各服务编译步骤
- 替换为直接基于官方自托管镜像 ghcr.io/webtor-io/self-hosted:latest
- 精简镜像体积和构建流程,减少维护成本
- 在README添加app_port配置,默认为8080端口
- Dockerfile +2 -261
- README.md +1 -0
Dockerfile
CHANGED
|
@@ -1,261 +1,2 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
ARG NODE_VER="23-alpine3.20"
|
| 4 |
-
ARG S6_OVERLAY_VER="3.2.0.2"
|
| 5 |
-
ARG S6_VERBOSITY=1
|
| 6 |
-
|
| 7 |
-
# Webtor services
|
| 8 |
-
ARG TORRENT_STORE_COMMIT="v1.0.0"
|
| 9 |
-
ARG MAGNET2TORRENT_COMMIT="v1.0.0"
|
| 10 |
-
ARG EXTERNAL_PROXY_COMMIT="v1.0.0"
|
| 11 |
-
ARG TORRENT_WEB_SEEDER_COMMIT="v1.0.0"
|
| 12 |
-
ARG TORRENT_WEB_SEEDER_CLEANER_COMMIT="v1.0.0"
|
| 13 |
-
ARG CONTENT_TRANSCODER_COMMIT="v1.0.0"
|
| 14 |
-
ARG TORRENT_ARCHIVER_COMMIT="v1.0.0"
|
| 15 |
-
ARG SRT2VTT_COMMIT="v1.0.0"
|
| 16 |
-
ARG TORRENT_HTTP_PROXY_COMMIT="v1.0.0"
|
| 17 |
-
ARG REST_API_COMMIT="v1.0.0"
|
| 18 |
-
ARG WEB_UI_COMMIT="v2.0.2"
|
| 19 |
-
|
| 20 |
-
# Nginx deps
|
| 21 |
-
ARG NGINX_VERSION="1.26.2"
|
| 22 |
-
ARG VOD_MODULE_COMMIT="26f06877b0f2a2336e59cda93a3de18d7b23a3e2"
|
| 23 |
-
ARG SECURE_TOKEN_MODULE_COMMIT="24f7b99d9b665e11c92e585d6645ed6f45f7d310"
|
| 24 |
-
|
| 25 |
-
FROM golang:$GOLANG_VER AS build-app
|
| 26 |
-
|
| 27 |
-
RUN apk add --no-cache build-base git
|
| 28 |
-
RUN git config --global http.version HTTP/1.1
|
| 29 |
-
|
| 30 |
-
WORKDIR /app
|
| 31 |
-
RUN mkdir "src" && mkdir "bin"
|
| 32 |
-
|
| 33 |
-
FROM build-app AS build-torrent-store
|
| 34 |
-
|
| 35 |
-
ARG TORRENT_STORE_COMMIT
|
| 36 |
-
|
| 37 |
-
ENV CGO_ENABLED=0 GOOS=linux
|
| 38 |
-
|
| 39 |
-
RUN echo $TORRENT_STORE_COMMIT > /app/bin/torrent-store.commit && \
|
| 40 |
-
git clone https://github.com/webtor-io/torrent-store /app/src/torrent-store && \
|
| 41 |
-
cd /app/src/torrent-store && \
|
| 42 |
-
git checkout $TORRENT_STORE_COMMIT && \
|
| 43 |
-
go build \
|
| 44 |
-
-ldflags '-w -s -X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=ignore' \
|
| 45 |
-
-a -installsuffix cgo -o /app/bin/torrent-store
|
| 46 |
-
|
| 47 |
-
FROM build-app AS build-magnet2torrent
|
| 48 |
-
|
| 49 |
-
ARG MAGNET2TORRENT_COMMIT
|
| 50 |
-
|
| 51 |
-
ENV CGO_ENABLED=0 GOOS=linux
|
| 52 |
-
|
| 53 |
-
RUN echo $MAGNET2TORRENT_COMMIT > /app/bin/magnet2torrent.commit && \
|
| 54 |
-
git clone https://github.com/webtor-io/magnet2torrent /app/src/magnet2torrent && \
|
| 55 |
-
cd /app/src/magnet2torrent/server && \
|
| 56 |
-
git checkout $MAGNET2TORRENT_COMMIT && \
|
| 57 |
-
go build \
|
| 58 |
-
-ldflags '-w -s -X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=ignore' \
|
| 59 |
-
-a -installsuffix cgo -o /app/bin/magnet2torrent
|
| 60 |
-
|
| 61 |
-
FROM build-app AS build-external-proxy
|
| 62 |
-
|
| 63 |
-
ARG EXTERNAL_PROXY_COMMIT
|
| 64 |
-
|
| 65 |
-
ENV CGO_ENABLED=0 GOOS=linux
|
| 66 |
-
|
| 67 |
-
RUN echo $EXTERNAL_PROXY_COMMIT > /app/bin/external-proxy.commit && \
|
| 68 |
-
git clone https://github.com/webtor-io/external-proxy /app/src/external-proxy && \
|
| 69 |
-
cd /app/src/external-proxy && \
|
| 70 |
-
git checkout $EXTERNAL_PROXY_COMMIT && \
|
| 71 |
-
go build \
|
| 72 |
-
-ldflags '-w -s' \
|
| 73 |
-
-a -installsuffix cgo -o /app/bin/external-proxy
|
| 74 |
-
|
| 75 |
-
FROM build-app AS build-torrent-web-seeder
|
| 76 |
-
|
| 77 |
-
ARG TORRENT_WEB_SEEDER_COMMIT
|
| 78 |
-
|
| 79 |
-
ENV CGO_LDFLAGS="-static" GOOS=linux
|
| 80 |
-
|
| 81 |
-
RUN echo $TORRENT_WEB_SEEDER_COMMIT > /app/bin/torrent-web-seeder.commit && \
|
| 82 |
-
git clone https://github.com/webtor-io/torrent-web-seeder /app/src/torrent-web-seeder && \
|
| 83 |
-
cd /app/src/torrent-web-seeder/server && \
|
| 84 |
-
git checkout $TORRENT_WEB_SEEDER_COMMIT && \
|
| 85 |
-
go build \
|
| 86 |
-
-ldflags '-w -s' \
|
| 87 |
-
-a -installsuffix cgo -o /app/bin/torrent-web-seeder
|
| 88 |
-
|
| 89 |
-
FROM build-app AS build-torrent-web-seeder-cleaner
|
| 90 |
-
|
| 91 |
-
ARG TORRENT_WEB_SEEDER_CLEANER_COMMIT
|
| 92 |
-
|
| 93 |
-
ENV CGO_ENABLED=0 GOOS=linux
|
| 94 |
-
|
| 95 |
-
RUN echo $TORRENT_WEB_SEEDER_CLEANER_COMMIT > /app/bin/torrent-web-seeder-cleaner.commit && \
|
| 96 |
-
git clone https://github.com/webtor-io/torrent-web-seeder-cleaner /app/src/torrent-web-seeder-cleaner && \
|
| 97 |
-
cd /app/src/torrent-web-seeder-cleaner && \
|
| 98 |
-
git checkout $TORRENT_WEB_SEEDER_CLEANER_COMMIT && \
|
| 99 |
-
go build \
|
| 100 |
-
-ldflags '-w -s' \
|
| 101 |
-
-a -installsuffix cgo -o /app/bin/torrent-web-seeder-cleaner
|
| 102 |
-
|
| 103 |
-
FROM build-app AS build-content-transcoder
|
| 104 |
-
|
| 105 |
-
ARG CONTENT_TRANSCODER_COMMIT
|
| 106 |
-
|
| 107 |
-
ENV CGO_ENABLED=0 GOOS=linux
|
| 108 |
-
|
| 109 |
-
RUN echo $CONTENT_TRANSCODER_COMMIT > /app/bin/content-transcoder.commit && \
|
| 110 |
-
git clone https://github.com/webtor-io/content-transcoder /app/src/content-transcoder && \
|
| 111 |
-
cd /app/src/content-transcoder && \
|
| 112 |
-
git checkout $CONTENT_TRANSCODER_COMMIT && \
|
| 113 |
-
go build \
|
| 114 |
-
-ldflags '-w -s' \
|
| 115 |
-
-a -installsuffix cgo -o /app/bin/content-transcoder
|
| 116 |
-
|
| 117 |
-
FROM build-app AS build-torrent-archiver
|
| 118 |
-
|
| 119 |
-
ARG TORRENT_ARCHIVER_COMMIT
|
| 120 |
-
|
| 121 |
-
ENV CGO_ENABLED=0 GOOS=linux
|
| 122 |
-
|
| 123 |
-
RUN echo $TORRENT_ARCHIVER_COMMIT > /app/bin/torrent-archiver.commit && \
|
| 124 |
-
git clone https://github.com/webtor-io/torrent-archiver /app/src/torrent-archiver && \
|
| 125 |
-
cd /app/src/torrent-archiver && \
|
| 126 |
-
git checkout $TORRENT_ARCHIVER_COMMIT && \
|
| 127 |
-
go build \
|
| 128 |
-
-ldflags '-w -s' \
|
| 129 |
-
-a -installsuffix cgo -o /app/bin/torrent-archiver
|
| 130 |
-
|
| 131 |
-
FROM build-app AS build-srt2vtt
|
| 132 |
-
|
| 133 |
-
ARG SRT2VTT_COMMIT
|
| 134 |
-
|
| 135 |
-
ENV GOOS=linux CGO_LDFLAGS="-static" CGO_ENABLED=1
|
| 136 |
-
|
| 137 |
-
RUN echo $SRT2VTT_COMMIT > /app/bin/srt2vtt.commit && \
|
| 138 |
-
git clone https://github.com/webtor-io/srt2vtt /app/src/srt2vtt && \
|
| 139 |
-
cd /app/src/srt2vtt && \
|
| 140 |
-
git checkout $SRT2VTT_COMMIT && \
|
| 141 |
-
go build \
|
| 142 |
-
-ldflags '-w -s' \
|
| 143 |
-
-a -installsuffix cgo -o /app/bin/srt2vtt
|
| 144 |
-
|
| 145 |
-
FROM build-app AS build-torrent-http-proxy
|
| 146 |
-
|
| 147 |
-
ARG TORRENT_HTTP_PROXY_COMMIT
|
| 148 |
-
|
| 149 |
-
ENV CGO_ENABLED=0 GOOS=linux
|
| 150 |
-
|
| 151 |
-
RUN echo $TORRENT_HTTP_PROXY_COMMIT > /app/bin/torrent-http-proxy.commit && \
|
| 152 |
-
git clone https://github.com/webtor-io/torrent-http-proxy /app/src/torrent-http-proxy && \
|
| 153 |
-
cd /app/src/torrent-http-proxy && \
|
| 154 |
-
git checkout $TORRENT_HTTP_PROXY_COMMIT && \
|
| 155 |
-
go build \
|
| 156 |
-
-ldflags '-w -s' \
|
| 157 |
-
-a -installsuffix cgo -o /app/bin/torrent-http-proxy
|
| 158 |
-
|
| 159 |
-
FROM build-app AS build-rest-api
|
| 160 |
-
|
| 161 |
-
ARG REST_API_COMMIT
|
| 162 |
-
|
| 163 |
-
ENV CGO_ENABLED=0 GOOS=linux
|
| 164 |
-
|
| 165 |
-
RUN echo $REST_API_COMMIT > /app/bin/rest-api.commit && \
|
| 166 |
-
git clone https://github.com/webtor-io/rest-api /app/src/rest-api && \
|
| 167 |
-
cd /app/src/rest-api && \
|
| 168 |
-
git checkout $REST_API_COMMIT && \
|
| 169 |
-
go build \
|
| 170 |
-
-ldflags '-w -s' \
|
| 171 |
-
-a -installsuffix cgo -o /app/bin/rest-api
|
| 172 |
-
|
| 173 |
-
FROM build-app AS build-web-ui
|
| 174 |
-
|
| 175 |
-
ARG WEB_UI_COMMIT
|
| 176 |
-
|
| 177 |
-
ENV CGO_ENABLED=0 GOOS=linux
|
| 178 |
-
|
| 179 |
-
RUN echo $WEB_UI_COMMIT > /app/bin/web-ui.commit && \
|
| 180 |
-
git clone https://github.com/webtor-io/web-ui /app/src/web-ui && \
|
| 181 |
-
cd /app/src/web-ui && \
|
| 182 |
-
git checkout $WEB_UI_COMMIT && \
|
| 183 |
-
go build \
|
| 184 |
-
-ldflags '-w -s -X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=ignore' \
|
| 185 |
-
-a -installsuffix cgo -o /app/bin/web-ui
|
| 186 |
-
|
| 187 |
-
FROM node:$NODE_VER AS build-web-ui-assets
|
| 188 |
-
|
| 189 |
-
WORKDIR /app
|
| 190 |
-
|
| 191 |
-
COPY --from=build-web-ui /app/src/web-ui .
|
| 192 |
-
|
| 193 |
-
RUN npm install
|
| 194 |
-
|
| 195 |
-
RUN npm run build
|
| 196 |
-
|
| 197 |
-
FROM alpine:$ALPINE_VER AS build-nginx-vod
|
| 198 |
-
|
| 199 |
-
ARG NGINX_VERSION
|
| 200 |
-
ARG VOD_MODULE_COMMIT
|
| 201 |
-
ARG SECURE_TOKEN_MODULE_COMMIT
|
| 202 |
-
|
| 203 |
-
RUN apk add --no-cache curl build-base openssl openssl-dev zlib-dev linux-headers pcre-dev && \
|
| 204 |
-
mkdir nginx nginx-vod-module nginx-secure-token-module && \
|
| 205 |
-
curl -sL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar -C /nginx --strip 1 -xz && \
|
| 206 |
-
curl -sL https://github.com/kaltura/nginx-vod-module/archive/${VOD_MODULE_COMMIT}.tar.gz | tar -C /nginx-vod-module --strip 1 -xz && \
|
| 207 |
-
curl -sL https://github.com/kaltura/nginx-secure-token-module/archive/${SECURE_TOKEN_MODULE_COMMIT}.tar.gz | tar -C /nginx-secure-token-module --strip 1 -xz
|
| 208 |
-
|
| 209 |
-
WORKDIR /nginx
|
| 210 |
-
RUN ./configure --prefix=/usr/local/nginx \
|
| 211 |
-
--add-module=../nginx-vod-module \
|
| 212 |
-
--add-module=../nginx-secure-token-module \
|
| 213 |
-
--with-http_ssl_module \
|
| 214 |
-
--with-file-aio \
|
| 215 |
-
--with-threads \
|
| 216 |
-
--with-cc-opt="-O3" && \
|
| 217 |
-
make && make install && \
|
| 218 |
-
rm -rf /nginx /nginx-vod-module /nginx-secure-token-module && \
|
| 219 |
-
rm -rf /usr/local/nginx/html /usr/local/nginx/conf/*.default
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
FROM alpine:$ALPINE_VER AS base
|
| 223 |
-
|
| 224 |
-
ARG S6_OVERLAY_VER
|
| 225 |
-
ARG S6_VERBOSITY
|
| 226 |
-
ENV S6_VERBOSITY=$S6_VERBOSITY
|
| 227 |
-
|
| 228 |
-
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VER}/s6-overlay-noarch.tar.xz /tmp
|
| 229 |
-
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
|
| 230 |
-
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VER}/s6-overlay-x86_64.tar.xz /tmp
|
| 231 |
-
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
|
| 232 |
-
RUN apk --no-cache add redis ffmpeg ca-certificates openssl pcre zlib envsubst uuidgen
|
| 233 |
-
|
| 234 |
-
WORKDIR /app
|
| 235 |
-
|
| 236 |
-
COPY --from=build-torrent-store /app/bin/* .
|
| 237 |
-
COPY --from=build-magnet2torrent /app/bin/* .
|
| 238 |
-
COPY --from=build-external-proxy /app/bin/* .
|
| 239 |
-
COPY --from=build-torrent-web-seeder /app/bin/* .
|
| 240 |
-
COPY --from=build-torrent-web-seeder-cleaner /app/bin/* .
|
| 241 |
-
COPY --from=build-content-transcoder /app/bin/* .
|
| 242 |
-
COPY --from=build-torrent-archiver /app/bin/* .
|
| 243 |
-
COPY --from=build-srt2vtt /app/bin/* .
|
| 244 |
-
COPY --from=build-torrent-http-proxy /app/bin/* .
|
| 245 |
-
COPY --from=build-rest-api /app/bin/* .
|
| 246 |
-
COPY --from=build-web-ui /app/bin/* .
|
| 247 |
-
COPY --from=build-web-ui /app/src/web-ui/templates /app/templates
|
| 248 |
-
COPY --from=build-web-ui /app/src/web-ui/pub /app/pub
|
| 249 |
-
COPY --from=build-web-ui-assets /app/assets/dist /app/assets/dist
|
| 250 |
-
COPY --from=build-nginx-vod /usr/local/nginx /usr/local/nginx
|
| 251 |
-
|
| 252 |
-
COPY etc/webtor /etc/webtor
|
| 253 |
-
COPY etc/nginx/conf /usr/local/nginx/conf
|
| 254 |
-
COPY s6-overlay /etc/s6-overlay
|
| 255 |
-
|
| 256 |
-
ENV DOMAIN=http://localhost:8080
|
| 257 |
-
|
| 258 |
-
EXPOSE 8080
|
| 259 |
-
# EXPOSE 8090 8091 8092 8093 8094 8095 8096 8097 8098
|
| 260 |
-
|
| 261 |
-
ENTRYPOINT ["/init"]
|
|
|
|
| 1 |
+
# 使用原基础镜像
|
| 2 |
+
FROM ghcr.io/webtor-io/self-hosted:latest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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@ colorFrom: purple
|
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
+
app_port: 8080
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|