diff --git a/Dockerfile b/Dockerfile index 7665671..37aa7d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,17 +3,20 @@ WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o livego ./ +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o livego . FROM alpine:latest LABEL maintainer="Ruben Cid Lara " +RUN mkdir -p /app/config +WORKDIR /app ENV RTMP_PORT 1935 ENV HTTP_FLV_PORT 7001 ENV HLS_PORT 7002 ENV HTTP_OPERATION_PORT 8090 +COPY --from=builder /app/config ./config COPY --from=builder /app/livego . EXPOSE ${RTMP_PORT} EXPOSE ${HTTP_FLV_PORT} EXPOSE ${HLS_PORT} EXPOSE ${HTTP_OPERATION_PORT} -CMD ./livego \ No newline at end of file +ENTRYPOINT ["./livego"] diff --git a/README.md b/README.md index 3c4da4f..71a0b2d 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,10 @@ Simple and efficient live broadcast server: After directly downloading the compiled [binary file](https://github.com/gwuhaolin/livego/releases), execute it on the command line. #### Boot from Docker -Run `docker run -p 1935: 1935 -p 7001: 7001 -p 7002: 7002 -d --name livego gwuhaolin / livego` to start +Run `docker run -p 1935:1935 -p 7001:7001 -p 7002:7002 -d --name livego gwuhaolin/livego` to start #### Compile from source -1. Download the source code `git clone https: // github.com / gwuhaolin / livego.git` +1. Download the source code `git clone https://github.com/gwuhaolin/livego.git` 2. Go to the livego directory and execute `go build` ## Use @@ -37,7 +37,6 @@ Run `docker run -p 1935: 1935 -p 7001: 7001 -p 7002: 7002 -d --name livego gwuha -`FLV`:`http://127.0.0.1:7001/live/movie.flv` -`HLS`:`http://127.0.0.1:7002/live/movie.m3u8` - ### [Use with flv.js](https://github.com/gwuhaolin/blog/issues/3) Interested in Golang? Please see [Golang Chinese Learning Materials Summary](http://go.wuhaolin.cn/) diff --git a/.livego.json b/config/livego.json similarity index 100% rename from .livego.json rename to config/livego.json diff --git a/main.go b/main.go index bdd45ff..3c2d83f 100755 --- a/main.go +++ b/main.go @@ -19,7 +19,7 @@ var ( httpFlvAddr = flag.String("httpflv-addr", ":7001", "HTTP-FLV server listen address") hlsAddr = flag.String("hls-addr", ":7002", "HLS server listen address") operaAddr = flag.String("manage-addr", ":8090", "HTTP manage interface server listen address") - configfilename = flag.String("cfgfile", ".livego.json", "configure filename") + configfilename = flag.String("config-file", "config/livego.json", "configure filename") ) func init() {