gdq-archive/streamserver/Dockerfile

93 lines
3.2 KiB
Docker

#ARG NGINX_VERSION=1.23.3
ARG NGINX_VERSION=1.25.0
FROM icedream/nginx as icedream-nginx
FROM nginx:${NGINX_VERSION}-alpine AS ffmpeg-build
# RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
# RUN apk update
RUN apk add sudo alpine-sdk git fdk-aac fdk-aac-dev
# Prepare abuild
WORKDIR /usr/src
RUN chown 999:0 /usr/src
RUN adduser -h /usr/src -S -u 999 apk
RUN addgroup apk abuild
RUN echo "apk ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER apk
RUN yes "" | abuild-keygen -a -i
# Check out aports
RUN git config --global user.name Docker
RUN git config --global user.email "$(whoami)@localhost"
# alpine docker image for nginx 1.25.0 uses alpine 3.17.3
RUN git clone --depth=1 -b 3.17-stable git://git.alpinelinux.org/aports
WORKDIR /usr/src/aports
# Apply package changes
COPY patches/aports-3.17 /patches/
RUN git am /patches/*.patch
WORKDIR /usr/src/aports/community/ffmpeg-serverkomplex
#RUN sed -i 's,^license=.\+$,license="non-free",g' APKBUILD
RUN sed -i 's,!check,!check !checkroot,g' APKBUILD
#RUN apkgrel -a .
RUN abuild -r
###
FROM alpine AS module-source
RUN apk add --no-cache git
RUN git config --global user.name Docker
RUN git config --global user.email "$(whoami)@localhost"
WORKDIR /usr/src
RUN git clone --depth=1 --recursive https://github.com/kaltura/nginx-vod-module.git
###
# This is the final image but with added fdk-aac support. We currently don't use
# it and the patch for the ffmpeg package is currently broken so it gets
# skipped.
FROM nginx:${NGINX_VERSION}-alpine AS final-patched
RUN \
export DEBIAN_FRONTEND=noninteractive &&\
if command -v apk >/dev/null 2>/dev/null; then apk add --no-cache gnupg; else apt-get update && apt-get install -y gnupg wget ca-certificates && apt-get clean; fi
COPY --from=icedream-nginx /usr/local/bin/docker-* /usr/local/bin/
COPY --from=module-source /usr/src/ /usr/src/nginx-modules/
COPY --from=ffmpeg-build /usr/src/packages/ /packages/
COPY --from=ffmpeg-build /etc/apk/keys/ /etc/apk/keys/
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN sed -i '1s#^#/packages/community\n#' /etc/apk/repositories
RUN cat /etc/apk/repositories
RUN apk update
RUN apk add ffmpeg-serverkomplex ffmpeg-serverkomplex-dev openssl openssl-dev fdk-aac
RUN \
docker-nginx-download-source &&\
docker-nginx-build \
--add-dynamic-module=../nginx-modules/nginx-vod-module --with-file-aio &&\
rm -rf /packages
RUN sed -i '1s#^#load_module modules/ngx_http_vod_module.so;\n#' /etc/nginx/nginx.conf
###
FROM nginx:${NGINX_VERSION}-alpine AS final
RUN \
export DEBIAN_FRONTEND=noninteractive &&\
if command -v apk >/dev/null 2>/dev/null; then apk add --no-cache gnupg; else apt-get update && apt-get install -y gnupg wget ca-certificates && apt-get clean; fi
COPY --from=icedream-nginx /usr/local/bin/docker-* /usr/local/bin/
COPY --from=module-source /usr/src/ /usr/src/nginx-modules/
RUN apk update
RUN apk add ffmpeg ffmpeg-dev openssl openssl-dev
RUN \
docker-nginx-download-source &&\
docker-nginx-build \
--add-dynamic-module=../nginx-modules/nginx-vod-module --with-file-aio &&\
rm -rf /packages
RUN sed -i '1s#^#load_module modules/ngx_http_vod_module.so;\n#' /etc/nginx/nginx.conf