添加 Dockerfile,并更新 Readme

This commit is contained in:
杨树海
2022-02-01 21:19:44 +08:00
parent 6df2a3b842
commit ac742d07cf
3 changed files with 63 additions and 1 deletions

View File

@@ -67,8 +67,16 @@ to submit your own plugin
|hls||✔|✔|
|ws-flv|||✔|
|webrtc|✔||✔
# Documentation
# Build & Test with docker
> development and testing only: IP and udp ports need to be exposed carefully in production.
```shell
docker build . -f dockerfile -t m7s:3.0
docker run --name m7s -p 1935:1935 -p 8081:8081 -p 8082:8082 -p 554:554 m7s:3.0
```
# Documentation
中文文档:
[http://docs.monibuca.com](http://docs.monibuca.com).

View File

@@ -47,6 +47,14 @@ bash <(curl -s -S -L https://monibuca.com/demo.sh)
功能强大的仪表盘可以直观的看到服务器运行的状态、消耗的资源、以及其他统计信息。用户可以利用控制台对服务器进行配置和控制。
# 在 Docker 中编译和测试
> 生产服务需要暴露IP和大量端口建议容器仅用于开发和测试
```shell
docker build . -f dockerfile -t m7s:3.0
docker run --name m7s -p 1935:1935 -p 8081:8081 -p 8082:8082 -p 554:554 m7s:3.0
```
# 交流微信群
进入网站首页上进行扫码

46
dockerfile Normal file
View File

@@ -0,0 +1,46 @@
FROM golang:1.17.0-alpine3.14 as builder
LABEL maintainer="yangshuhai@pdnews.cn"
WORKDIR /app
# 先装好基础依赖,减少在代码变化时的重复构建时间
RUN echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.14/main" > /etc/apk/repositories
RUN echo "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.14/community" >> /etc/apk/repositories
RUN apk add --no-cache --update autoconf automake make gcc g++
RUN go env -w GO111MODULE=on
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN go get -d github.com/Monibuca/engine/v3@v3.4.7
RUN go get -d github.com/Monibuca/plugin-gateway/v3@v3.0.10
RUN go get -d github.com/Monibuca/plugin-gb28181/v3@v3.0.2
RUN go get -d github.com/Monibuca/plugin-hdl/v3@v3.0.5
RUN go get -d github.com/Monibuca/plugin-hls/v3@v3.0.6
RUN go get -d github.com/Monibuca/plugin-jessica/v3@v3.0.0
RUN go get -d github.com/Monibuca/plugin-logrotate/v3@v3.0.0
RUN go get -d github.com/Monibuca/plugin-record/v3@v3.0.0
RUN go get -d github.com/Monibuca/plugin-rtmp/v3@v3.0.1
RUN go get -d github.com/Monibuca/plugin-rtsp/v3@v3.0.7
RUN go get -d github.com/Monibuca/plugin-summary@v1.0.0
RUN go get -d github.com/Monibuca/plugin-ts/v3@v3.0.1
RUN go get -d github.com/Monibuca/plugin-webrtc/v3@v3.0.3
# 再复制代码进行编译,可节省大量构建时间
COPY . .
RUN go mod tidy
RUN GOOS=linux go build -o m7s
# 构建完成则将成品复制到新的镜像中,减小镜像大小,可以考虑添加 upx 进一步减少空间
FROM alpine:3.14
WORKDIR /app
COPY --from=builder /app/m7s /app/m7s
COPY config.toml /app/config.toml
RUN /app/m7s --help
EXPOSE 554
EXPOSE 1935
EXPOSE 5060
EXPOSE 8081
EXPOSE 8082
CMD ["/app/m7s", "-c", "/app/config.toml"]