-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.build
More file actions
70 lines (64 loc) · 2.15 KB
/
Dockerfile.build
File metadata and controls
70 lines (64 loc) · 2.15 KB
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
FROM golang:1.25-bookworm
# Install build dependencies
# libasound2-dev: dynamic ALSA - universally present on Linux so its ok we dynamically link this
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
git \
nasm \
yasm \
pkg-config \
libasound2-dev \
texinfo \
wget \
zlib1g-dev \
meson \
ninja-build \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /tmp
# Build dav1d as static lib
RUN git clone --depth 1 --branch 1.5.1 https://code.videolan.org/videolan/dav1d.git && \
cd dav1d && \
meson setup build --default-library=static --prefix=/usr/local \
--buildtype=release -Denable_tools=false -Denable_tests=false && \
ninja -C build && \
ninja -C build install
# Build FFmpeg 8.0.1
# static, decode-only, minimal codecs
# Built-in decoders (h264, hevc, vp9, aac, mp3, opus, vorbis) need no external libs
# Only dav1d is added for faster AV1 decoding
RUN wget https://ffmpeg.org/releases/ffmpeg-8.0.1.tar.xz && \
tar xf ffmpeg-8.0.1.tar.xz && \
cd ffmpeg-8.0.1 && \
./configure \
--prefix=/usr/local \
--enable-gpl \
--enable-version3 \
--enable-libdav1d \
--enable-static \
--disable-shared \
--disable-doc \
--disable-debug \
--disable-programs \
--disable-encoders \
--disable-muxers \
--disable-devices \
--disable-filters \
--enable-filter=aresample \
--enable-filter=scale \
--enable-filter=null \
--enable-filter=anull \
--disable-network \
--disable-autodetect \
--enable-pthreads \
--enable-zlib && \
make -j$(nproc) && \
make install && \
ldconfig && \
cd / && rm -rf /tmp/ffmpeg-8.0.1* /tmp/dav1d
# Bake CGO flags into the image
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib/x86_64-linux-gnu/pkgconfig
ENV CGO_ENABLED=1
ENV CGO_CFLAGS="-I/usr/local/include"
ENV CGO_LDFLAGS="-L/usr/local/lib -L/usr/local/lib/x86_64-linux-gnu -lavdevice -lavformat -lavcodec -ldav1d -ldl -lz -lavfilter -lm -lswscale -lswresample -lavutil -lm -latomic -pthread -lasound -lz -lm -ldl -lpthread"
WORKDIR /app