Skip to content

Commit

Permalink
Merge pull request #122 from trulykyle/v4
Browse files Browse the repository at this point in the history
docker support
  • Loading branch information
langhuihui authored Apr 30, 2024
2 parents e4fd81c + 91d0e20 commit 21e0843
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
37 changes: 28 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
#源镜像
# Compile Stage
FROM golang:1.22.2-alpine3.19 AS builder
MAINTAINER monibuca <[email protected]>

LABEL stage=gobuilder

# Env
ENV CGO_ENABLE 0
ENV GOOS linux
ENV GOARCH amd64
ENV GOPROXY https://goproxy.cn,direct
ENV HOME /monibuca

COPY . /monibuca
WORKDIR /monibuca

# compile
RUN go mod download
RUN go build -ldflags="-s -w" -o /monibuca/build/monibuca ./main.go

RUN cp -r /monibuca/config.yaml /monibuca/build
RUN cp -r /monibuca/favicon.ico /monibuca/build

# Running Stage
FROM alpine:latest

WORKDIR /opt
WORKDIR /monibuca
COPY --from=builder /monibuca/build /monibuca/

ADD monibuca_linux /opt
ADD favicon.ico /opt
ADD config.yaml /opt
# RUN apk --no-cache add ffmpeg
#暴露端口
# Export necessary ports
EXPOSE 8080 8443 1935 554 58200-59200 5060 8000-9000
EXPOSE 5060/udp 58200-59200/udp 8000-9000/udp

#最终运行docker的命令
ENTRYPOINT ["./monibuca_linux"]
CMD [ "./monibuca" ]
10 changes: 10 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
monibuca:
build:
dockerfile: ./Dockerfile
image: monibuca:v4
restart: unless-stopped
#please use host mode as expose large number of ports will cause docker extremely slow
network_mode: host
volumes:
- ${PWD}/config.yaml:/monibuca/config.yaml

0 comments on commit 21e0843

Please sign in to comment.