Dockerfile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ARG ARCH
  2. FROM ${ARCH}ossrs/srs:ubuntu20 AS build
  3. ARG BUILDPLATFORM
  4. ARG TARGETPLATFORM
  5. ARG JOBS=2
  6. ARG SRS_AUTO_PACKAGER
  7. RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, JOBS: $JOBS, PACKAGER: ${#SRS_AUTO_PACKAGER}"
  8. # https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
  9. ENV DEBIAN_FRONTEND noninteractive
  10. # Install depends tools.
  11. RUN apt-get update && apt-get install -y gcc make g++ patch unzip perl git
  12. # Build and install SRS.
  13. COPY . /srs
  14. WORKDIR /srs/trunk
  15. RUN ./configure --srt=on --jobs=${JOBS} && make -j${JOBS} && make install
  16. # All config files for SRS.
  17. RUN cp -R conf /usr/local/srs/conf && \
  18. cp research/api-server/static-dir/index.html /usr/local/srs/objs/nginx/html/ && \
  19. cp research/api-server/static-dir/favicon.ico /usr/local/srs/objs/nginx/html/ && \
  20. cp research/players/crossdomain.xml /usr/local/srs/objs/nginx/html/ && \
  21. cp -R research/console /usr/local/srs/objs/nginx/html/ && \
  22. cp -R research/players /usr/local/srs/objs/nginx/html/ && \
  23. cp -R 3rdparty/signaling/www/demos /usr/local/srs/objs/nginx/html/
  24. ############################################################
  25. # dist
  26. ############################################################
  27. FROM ${ARCH}ubuntu:focal AS dist
  28. ARG BUILDPLATFORM
  29. ARG TARGETPLATFORM
  30. RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM"
  31. # Expose ports for streaming @see https://github.com/ossrs/srs#ports
  32. EXPOSE 1935 1985 8080 8000/udp 10080/udp
  33. # FFMPEG 4.1
  34. COPY --from=build /usr/local/bin/ffmpeg /usr/local/srs/objs/ffmpeg/bin/ffmpeg
  35. # SRS binary, config files and srs-console.
  36. COPY --from=build /usr/local/srs /usr/local/srs
  37. # Default workdir and command.
  38. WORKDIR /usr/local/srs
  39. CMD ["./objs/srs", "-c", "conf/docker.conf"]