Dockerfile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. ############################################################
  17. # dist
  18. ############################################################
  19. FROM ${ARCH}ubuntu:focal AS dist
  20. ARG BUILDPLATFORM
  21. ARG TARGETPLATFORM
  22. RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM"
  23. # Expose ports for streaming @see https://github.com/ossrs/srs#ports
  24. EXPOSE 1935 1985 8080 8000/udp 10080/udp
  25. # FFMPEG 4.1
  26. COPY --from=build /usr/local/bin/ffmpeg /usr/local/srs/objs/ffmpeg/bin/ffmpeg
  27. # SRS binary, config files and srs-console.
  28. COPY --from=build /usr/local/srs /usr/local/srs
  29. # Test the version of binaries.
  30. RUN ldd /usr/local/srs/objs/ffmpeg/bin/ffmpeg && \
  31. /usr/local/srs/objs/ffmpeg/bin/ffmpeg -version && \
  32. ldd /usr/local/srs/objs/srs && \
  33. /usr/local/srs/objs/srs -v
  34. # Default workdir and command.
  35. WORKDIR /usr/local/srs
  36. CMD ["./objs/srs", "-c", "conf/docker.conf"]