-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
Copy pathDockerfile
95 lines (82 loc) · 3.03 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
FROM ubuntu:noble AS builder
ARG FFMPEG_VERSION="7.1"
ARG RCLONE_VER="v1.69.0"
ARG GO_VERSION="latest"
USER root
#======================================
# Install build tools
#======================================
ARG TOOLS_DEPS="autoconf automake cmake libfreetype6 gcc build-essential libtool make nasm pkg-config zlib1g-dev numactl \
libnuma-dev yasm git curl jq wget ca-certificates \
libx11-dev libxcb1-dev libpulse-dev libasound2-dev"
RUN apt-get update -qqy \
&& apt-get upgrade -yq \
&& apt-get -qqy --no-install-recommends install ${TOOLS_DEPS} \
&& apt-get -qyy clean \
&& mkdir -p /usr/local/src
RUN if [ "${GO_VERSION}" = "latest" ]; then \
GO_VERSION=$(curl -sk https://go.dev/dl/?mode=json | jq -r '.[0].version'); \
fi \
&& curl -skLO https://go.dev/dl/${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz \
&& tar -xf ${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz -C /usr/local \
&& rm -rf ${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz* \
&& ln -sf /usr/local/go/bin/go /usr/bin/go \
&& go version
RUN cd /usr/local/src \
&& git clone https://github.com/rclone/rclone.git \
&& cd rclone \
&& git checkout ${RCLONE_VER} \
# Patch deps version in go.mod to fix CVEs
# && sed -i "s|golang.org/x/crypto v.*|golang.org/x/crypto ${GO_CRYPTO_VERSION}|g" go.mod \
# && sed -i "s|golang.org/x/net v.*|golang.org/x/net ${GO_NET_VERSION}|g" go.mod \
# && go mod tidy \
# Build rclone
&& make \
&& mv ~/go/bin/rclone /usr/local/bin/ \
&& rclone version
#======================================
# Install x264 from source
#======================================
RUN cd /usr/local/src \
&& git clone https://code.videolan.org/videolan/x264.git \
&& cd x264 \
&& ./configure --prefix="/usr/local" --enable-static \
&& make \
&& make install
#======================================
# Install FFmpeg from source
#======================================
RUN cd /usr/local/src \
&& git clone https://github.com/FFmpeg/FFmpeg.git \
&& cd FFmpeg \
&& git checkout release/${FFMPEG_VERSION} \
&& rm -rf .git \
&& PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" FFMPEG_VERSION=${FFMPEG_VERSION} ./configure \
--prefix="/usr/local" \
--extra-cflags="-I/usr/local/include" \
--extra-ldflags="-L/usr/local/lib" \
--pkg-config-flags="--static" \
--enable-gpl \
--enable-nonfree \
--enable-libx264 \
--enable-libxcb \
--enable-libpulse \
--enable-alsa \
--enable-static \
&& make \
&& make install
# Final stage
FROM ubuntu:noble
USER root
COPY --from=builder /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
COPY --from=builder /usr/local/bin/rclone /usr/local/bin/rclone
RUN apt-get -qqy update \
&& apt-get -qqy --no-install-recommends install \
libx11-6 libx11-xcb1 libxcb1 libpulse0 libasound2t64 \
&& apt-get -qqy update \
&& apt-get -yq upgrade \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
RUN ldd /usr/local/bin/ffmpeg \
&& ffmpeg -version \
&& rclone --version
USER 101