2022-06-11 02:17:33 +00:00
|
|
|
ARG ARCH
|
2022-06-17 06:18:27 +00:00
|
|
|
ARG IMAGE=ossrs/srs:ubuntu20
|
|
|
|
FROM ${ARCH}${IMAGE} AS build
|
2021-08-14 12:46:52 +00:00
|
|
|
|
2022-12-25 09:00:07 +00:00
|
|
|
ARG CONFARGS
|
|
|
|
ARG MAKEARGS
|
|
|
|
ARG INSTALLDEPENDS
|
2022-06-11 02:17:33 +00:00
|
|
|
ARG BUILDPLATFORM
|
|
|
|
ARG TARGETPLATFORM
|
2022-01-13 09:08:01 +00:00
|
|
|
ARG SRS_AUTO_PACKAGER
|
2022-12-25 09:00:07 +00:00
|
|
|
RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, PACKAGER: ${#SRS_AUTO_PACKAGER}, CONFARGS: ${CONFARGS}, MAKEARGS: ${MAKEARGS}, INSTALLDEPENDS: ${INSTALLDEPENDS}"
|
2022-06-11 02:17:33 +00:00
|
|
|
|
|
|
|
# https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
|
2022-06-17 06:18:27 +00:00
|
|
|
# To use if in RUN, see https://github.com/moby/moby/issues/7281#issuecomment-389440503
|
|
|
|
# Note that only exists issue like "/bin/sh: 1: [[: not found" for Ubuntu20, no such problem in CentOS7.
|
|
|
|
SHELL ["/bin/bash", "-c"]
|
|
|
|
|
2022-06-11 02:17:33 +00:00
|
|
|
# Install depends tools.
|
2022-12-25 09:00:07 +00:00
|
|
|
RUN if [[ $INSTALLDEPENDS != 'NO' ]]; then \
|
|
|
|
apt-get update && apt-get install -y gcc make g++ patch unzip perl git libasan5; \
|
|
|
|
fi
|
2022-01-13 09:08:01 +00:00
|
|
|
|
2022-06-17 06:18:27 +00:00
|
|
|
# Copy source code to docker.
|
2021-08-15 11:01:55 +00:00
|
|
|
COPY . /srs
|
|
|
|
WORKDIR /srs/trunk
|
2022-06-17 06:18:27 +00:00
|
|
|
|
|
|
|
# Build and install SRS.
|
|
|
|
# Note that SRT is enabled by default, so we configure without --srt=on.
|
2022-12-24 02:19:53 +00:00
|
|
|
# Note that we have copied all files by make install.
|
2023-01-02 06:57:47 +00:00
|
|
|
RUN ./configure --gb28181=on ${CONFARGS} && make ${MAKEARGS} && make install
|
2021-08-14 12:46:52 +00:00
|
|
|
|
|
|
|
############################################################
|
|
|
|
# dist
|
|
|
|
############################################################
|
2022-06-11 02:17:33 +00:00
|
|
|
FROM ${ARCH}ubuntu:focal AS dist
|
|
|
|
|
|
|
|
ARG BUILDPLATFORM
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM"
|
2021-08-14 12:46:52 +00:00
|
|
|
|
2021-08-14 13:10:42 +00:00
|
|
|
# Expose ports for streaming @see https://github.com/ossrs/srs#ports
|
Support HTTP-API for fetching reload result. v5.0.176 (#3779)
During a Reload, several stages will be passed through:
1. Parsing new configurations: Parse.
2. Transforming configurations: Transform.
3. Applying configurations: Apply.
Previously, any error at any stage would result in a direct exit, making
the system completely dependent on configuration checks:
```bash
./objs/srs -c conf/srs.conf -t
echo $?
```
Optimized to: If an error occurs before applying the configuration, it
can be ignored. If an error occurs during the application of the
configuration, some of the configuration may have already taken effect,
leading to unpredictable behavior, so SRS will exit directly.
Added a new HTTP API to query the result of the reload.
```nginx
http_api {
enabled on;
raw_api {
enabled on;
allow_reload on;
}
}
```
```bash
curl http://localhost:1985/api/v1/raw?rpc=reload-fetch
```
```json
{
"code": 0,
"data": {
"err": 0,
"msg": "Success",
"state": 0,
"rid": "0s6y0n9"
}
}
{
"code": 0,
"data": {
"err": 1023,
"msg": "code=1023(ConfigInvalid) : parse file : parse buffer containers/conf/srs.release-local.conf : root parse : parse dir : parse include buffer containers/data/config/srs.vhost.conf : read token, line=0, state=0 : line 3: unexpected end of file, expecting ; or \"}\"",
"state": 1,
"rid": "0g4z471"
}
}
```
This way, you can know if the last reload of the system was successful.
---------
Co-authored-by: Haibo Chen <495810242@qq.com>
2023-08-30 11:11:57 +00:00
|
|
|
EXPOSE 1935 1985 8080 5060 9000 8000/udp 10080/udp
|
2021-08-14 12:46:52 +00:00
|
|
|
|
|
|
|
# FFMPEG 4.1
|
|
|
|
COPY --from=build /usr/local/bin/ffmpeg /usr/local/srs/objs/ffmpeg/bin/ffmpeg
|
|
|
|
# SRS binary, config files and srs-console.
|
|
|
|
COPY --from=build /usr/local/srs /usr/local/srs
|
|
|
|
|
2022-08-29 11:23:02 +00:00
|
|
|
# Test the version of binaries.
|
|
|
|
RUN ldd /usr/local/srs/objs/ffmpeg/bin/ffmpeg && \
|
|
|
|
/usr/local/srs/objs/ffmpeg/bin/ffmpeg -version && \
|
|
|
|
ldd /usr/local/srs/objs/srs && \
|
|
|
|
/usr/local/srs/objs/srs -v
|
|
|
|
|
2021-08-14 12:46:52 +00:00
|
|
|
# Default workdir and command.
|
|
|
|
WORKDIR /usr/local/srs
|
Refine docker detect mechenism. v5.0.190 (#3758)
When using Docker, logs are usually printed to console (stdout and
stderr). However, since Docker detection occurs late, after log
initialization, the default log output may be incorrect. In Docker, logs
may still be written to a file instead of the console as expected.
Additionally, the Dockerfile has been improved with a new environment
variable `SRS_IN_DOCKER=on` to clearly indicate a Docker environment. If
automatic Docker detection fails, the configuration will be read, and
this variable will correctly inform SRS that it's in a Docker
environment.
Lastly, the default configuration values have been improved for Docker
environments. By default, `SRS_LOG_TANK=console` and daemon mode is
disabled.
---------
Co-authored-by: john <hondaxiao@tencent.com>
2023-10-17 13:27:07 +00:00
|
|
|
ENV SRS_DAEMON=off SRS_IN_DOCKER=on
|
2023-10-09 11:41:59 +00:00
|
|
|
CMD ["./objs/srs", "-c", "conf/docker.conf"]
|
2022-12-31 01:38:59 +00:00
|
|
|
|