Dockerfile.nginx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. && mkdir /tmp/nginx-rtmp-module \
  21. && 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
  22. WORKDIR /tmp/nginx
  23. RUN ./configure --prefix=/usr/local/nginx \
  24. --with-file-aio \
  25. --with-http_sub_module \
  26. --with-http_ssl_module \
  27. --with-threads \
  28. --add-module=../nginx-vod-module \
  29. --add-module=../nginx-rtmp-module \
  30. --with-cc-opt="-O3 -Wno-error=implicit-fallthrough"
  31. RUN make && make install
  32. RUN rm -rf /usr/local/nginx/html /usr/local/nginx/conf/*.default
  33. FROM base
  34. COPY --from=build /usr/local/nginx /usr/local/nginx
  35. ENTRYPOINT ["/usr/local/nginx/sbin/nginx"]
  36. CMD ["-g", "daemon off;"]