-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
executable file
·124 lines (107 loc) · 2.62 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
FROM golang:1.13.6-alpine3.11 as builder
RUN apk add --no-cache curl
# ffmpeg source - https://github.com/alfg/docker-ffmpeg
ARG FFMPEG_VERSION=6.0
ARG PREFIX=/opt/ffmpeg
ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib
ARG MAKEFLAGS="-j4"
# FFmpeg build dependencies.
RUN apk update && apk add --update \
build-base \
coreutils \
freetype-dev \
gcc \
lame-dev \
openssl-dev \
libogg-dev \
libass \
libass-dev \
libvpx-dev \
libvorbis-dev \
libwebp-dev \
libtheora-dev \
opus-dev \
pkgconf \
pkgconfig \
rtmpdump-dev \
wget \
x264-dev \
x265-dev \
yasm
# Get fdk-aac from community.
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
apk add --update fdk-aac-dev
# Get ffmpeg source.
RUN cd /tmp/ && \
wget http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
tar zxf ffmpeg-${FFMPEG_VERSION}.tar.gz && rm ffmpeg-${FFMPEG_VERSION}.tar.gz
# Compile ffmpeg.
RUN cd /tmp/ffmpeg-${FFMPEG_VERSION} && \
./configure \
--enable-version3 \
--enable-gpl \
--enable-nonfree \
--enable-small \
--enable-libmp3lame \
--enable-openssl \
--enable-libx264 \
--enable-libx265 \
--enable-libvpx \
--enable-libtheora \
--enable-libvorbis \
--enable-libopus \
--enable-libfdk-aac \
--enable-libass \
--enable-libwebp \
--enable-librtmp \
--enable-postproc \
--enable-avresample \
--enable-libfreetype \
--disable-debug \
--disable-doc \
--disable-ffplay \
--extra-cflags="-I${PREFIX}/include" \
--extra-ldflags="-L${PREFIX}/lib" \
--extra-libs="-lpthread -lm" \
--prefix="${PREFIX}" && \
make && make install && make distclean
# Cleanup.
RUN rm -rf /var/cache/apk/* /tmp/*
WORKDIR /app
COPY src src
COPY templates templates
COPY go.mod go.mod
RUN go mod download
RUN go build -x -o media-roller ./src
# youtube-dl needs python
FROM python:3.8.1-alpine3.11
# This is where the downloaded files will be saved in the container.
ENV MR_DOWNLOAD_DIR="/download"
ENV PATH=/opt/ffmpeg/bin:$PATH
RUN apk add --update --no-cache \
curl \
ca-certificates \
openssl \
pcre \
lame \
libogg \
libass \
libvpx \
libvorbis \
libwebp \
libtheora \
opus \
rtmpdump \
x264-dev \
x265-dev
COPY --from=builder /app/media-roller /app/media-roller
COPY --from=builder /opt/ffmpeg /opt/ffmpeg
COPY --from=builder /usr/lib/libfdk-aac.so.2 /usr/lib/libfdk-aac.so.2
COPY templates /app/templates
COPY static /app/static
WORKDIR /app
RUN curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl && \
chmod a+rx /usr/local/bin/youtube-dl && \
youtube-dl --version && \
ffmpeg -version
CMD /app/media-roller