forked from biliup/biliup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
96 lines (91 loc) · 2.29 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Build biliup's web-ui
FROM node:lts as webui
ARG repo_url=https://github.com/biliup/biliup
ARG branch_name=master
RUN set -eux; \
git clone --depth 1 --branch "$branch_name" "$repo_url"; \
cd biliup; \
npm install; \
npm run build
# Deploy Biliup
FROM python:3.12-slim as biliup
ARG repo_url=https://github.com/biliup/biliup
ARG branch_name=master
ENV TZ=Asia/Shanghai
EXPOSE 19159/tcp
VOLUME /opt
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
useApt=false; \
apt-get update; \
apt-get install -y --no-install-recommends \
wget \
xz-utils \
; \
apt-mark auto '.*' > /dev/null; \
\
arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; \
url='https://github.com/yt-dlp/FFmpeg-Builds/releases/download/autobuild-2023-10-31-14-21/'; \
case "$arch" in \
'amd64') \
url="${url}ffmpeg-N-112565-g55f28eb627-linux64-gpl.tar.xz"; \
;; \
'arm64') \
url="${url}ffmpeg-N-112565-g55f28eb627-linuxarm64-gpl.tar.xz"; \
;; \
*) \
useApt=true; \
;; \
esac; \
\
if [ "$useApt" = true ] ; then \
apt-get install -y --no-install-recommends \
ffmpeg \
; \
else \
wget -O ffmpeg.tar.xz "$url" --progress=dot:giga; \
tar -xJf ffmpeg.tar.xz -C /usr/local --strip-components=1; \
rm -rf \
/usr/local/doc \
/usr/local/man; \
rm -rf \
/usr/local/bin/ffplay; \
rm -rf \
ffmpeg*; \
chmod a+x /usr/local/* ; \
fi; \
\
# Clean up \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf \
/tmp/* \
/usr/share/doc/* \
/var/cache/* \
/var/lib/apt/lists/* \
/var/tmp/* \
/var/log/*
RUN set -eux; \
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends git g++; \
git clone --depth 1 --branch "$branch_name" "$repo_url"; \
cd biliup && \
pip3 install --no-cache-dir quickjs && \
pip3 install -e . && \
\
# Clean up \
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf \
/tmp/* \
/usr/share/doc/* \
/var/cache/* \
/var/lib/apt/lists/* \
/var/tmp/* \
/var/log/*
COPY --from=webui /biliup/biliup/web/public/ /biliup/biliup/web/public/
WORKDIR /opt
ENTRYPOINT ["biliup"]