Dockerfile.nginx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 SECURE_TOKEN_MODULE_VERSION=1.4
  11. ARG RTMP_MODULE_VERSION=1.2.1
  12. RUN cp /etc/apt/sources.list /etc/apt/sources.list~ \
  13. && sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list \
  14. && apt-get update
  15. RUN apt-get -yqq build-dep nginx
  16. RUN apt-get -yqq install --no-install-recommends curl \
  17. && mkdir /tmp/nginx \
  18. && curl -sL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar -C /tmp/nginx -zx --strip-components=1 \
  19. && mkdir /tmp/nginx-vod-module \
  20. && 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 \
  21. # Patch MAX_CLIPS to allow more clips to be added than the default 128
  22. && sed -i 's/MAX_CLIPS (128)/MAX_CLIPS (1080)/g' /tmp/nginx-vod-module/vod/media_set.h \
  23. && mkdir /tmp/nginx-secure-token-module \
  24. && curl -sL https://github.com/kaltura/nginx-secure-token-module/archive/refs/tags/${SECURE_TOKEN_MODULE_VERSION}.tar.gz | tar -C /tmp/nginx-secure-token-module -zx --strip-components=1 \
  25. && mkdir /tmp/nginx-rtmp-module \
  26. && 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
  27. WORKDIR /tmp/nginx
  28. RUN ./configure --prefix=/usr/local/nginx \
  29. --with-file-aio \
  30. --with-http_sub_module \
  31. --with-http_ssl_module \
  32. --with-threads \
  33. --add-module=../nginx-vod-module \
  34. --add-module=../nginx-secure-token-module \
  35. --add-module=../nginx-rtmp-module \
  36. --with-cc-opt="-O3 -Wno-error=implicit-fallthrough"
  37. RUN make && make install
  38. RUN rm -rf /usr/local/nginx/html /usr/local/nginx/conf/*.default
  39. FROM base
  40. COPY --from=build /usr/local/nginx /usr/local/nginx
  41. ENTRYPOINT ["/usr/local/nginx/sbin/nginx"]
  42. CMD ["-g", "daemon off;"]