Dockerfile.nginx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. FROM ubuntu:20.04 AS base
  2. ENV DEBIAN_FRONTEND=noninteractive
  3. RUN apt-get -yqq update && \
  4. apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \
  5. apt-get autoremove -y && \
  6. apt-get clean -y
  7. FROM base as build
  8. ARG NGINX_VERSION=1.18.0
  9. ARG VOD_MODULE_VERSION=1.28
  10. ARG RTMP_MODULE_VERSION=1.2.1
  11. RUN cp /etc/apt/sources.list /etc/apt/sources.list~ \
  12. && sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list \
  13. && apt-get update
  14. RUN apt-get -yqq build-dep nginx
  15. RUN apt-get -yqq install --no-install-recommends curl \
  16. && mkdir /tmp/nginx \
  17. && curl -sL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar -C /tmp/nginx -zx --strip-components=1 \
  18. && mkdir /tmp/nginx-vod-module \
  19. && curl -sL https://github.com/kaltura/nginx-vod-module/archive/refs/tags/${VOD_MODULE_VERSION}.tar.gz | tar -C /tmp/nginx-vod-module -zx --strip-components=1 \
  20. # Patch MAX_CLIPS to allow more clips to be added than the default 128
  21. && sed -i 's/MAX_CLIPS (128)/MAX_CLIPS (1080)/g' /tmp/nginx-vod-module/vod/media_set.h \
  22. && mkdir /tmp/nginx-rtmp-module \
  23. && curl -sL https://github.com/arut/nginx-rtmp-module/archive/refs/tags/v${RTMP_MODULE_VERSION}.tar.gz | tar -C /tmp/nginx-rtmp-module -zx --strip-components=1
  24. WORKDIR /tmp/nginx
  25. RUN ./configure --prefix=/usr/local/nginx \
  26. --with-file-aio \
  27. --with-http_sub_module \
  28. --with-http_ssl_module \
  29. --with-threads \
  30. --add-module=../nginx-vod-module \
  31. --add-module=../nginx-rtmp-module \
  32. --with-cc-opt="-O3 -Wno-error=implicit-fallthrough"
  33. RUN make && make install
  34. RUN rm -rf /usr/local/nginx/html /usr/local/nginx/conf/*.default
  35. FROM base
  36. COPY --from=build /usr/local/nginx /usr/local/nginx
  37. ENTRYPOINT ["/usr/local/nginx/sbin/nginx"]
  38. CMD ["-g", "daemon off;"]