mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-27 21:42:01 -08:00
add docker hub images
This commit is contained in:
parent
60371afc1a
commit
8b67b5bd89
3 changed files with 109 additions and 33 deletions
26
.travis.yml
26
.travis.yml
|
|
@ -1,19 +1,37 @@
|
|||
language: minimal
|
||||
|
||||
dist: bionic
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
# docker >= 19.03 is required for docker buildx, so it is upgraded
|
||||
before_install:
|
||||
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||
- sudo apt update -y
|
||||
- sudo apt install --only-upgrade docker-ce -y
|
||||
|
||||
script:
|
||||
- make test
|
||||
- make release
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: RmEv6bgtRwQr7JDFHFNDbv2nKve8Y+299/S9Ez39ZobX4F8870Szl329OjnL2B82wYWQg3GzPZ6pkcsm6OUV1Xms+Bo0a+QIOTddmNmzOyd70+IG7BtFjDa4HQ7rrxOt/kr5NAOP0R9h5oVq1+mlMOMEeB6BBo4SNG4V3YIkuXxVUTOtiJdyJDlqIvjgei7PWIierazTmdDmEkvdeXWKfbMXFKWu8v+vNVXYXsq4rX4f4eyivNYQuOnCKKjr3XB4QAigRijbLubxpc+GAlEQrxSzQkHR95lLE/w6xUkeYM0qL0OF1W3+nWYk7C3gGYVHXIaSse+7+UqhGtroZmxtaiP5duvOhW8ikamvEcLkiYEfvnmTJDUldGR27xQZ7wJRvtWhl4TMqSCHBgTWvPtf7l55rLTZmibsrE0AttJZF1UkPoVQ+j/wvUP8azqaNiwDrDU6F7NHXn8jhoLfnELtPe9Ed6o0JHr+Asuv1sooOOU+af3Y8cYlFTH3+NResrGdSUQ0n9OkRIv1pHN2T/FTLL74HWS0tlahhA6FAIqxfbffypSrMP4NhcwC7YI0dystLxJd1BmOxFBn9ov+vfqNi7yhyG+bwEcFPfi6h0bd5xa3ni0erdKI1ner8GaQSThWkgGD91X+0Rg5VDN9OKg3lcpO7Xz+GbJUpMMuXWpuWcI=
|
||||
- provider: script
|
||||
script: make release
|
||||
on:
|
||||
repo: aler9/rtsp-simple-server
|
||||
tags: true
|
||||
|
||||
- provider: releases
|
||||
api_key: $GITHUB_API_KEY
|
||||
skip_cleanup: true
|
||||
file_glob: true
|
||||
file: release/*
|
||||
on:
|
||||
repo: aler9/rtsp-simple-server
|
||||
tags: true
|
||||
|
||||
- provider: script
|
||||
script: docker login -u aler9 -p $DOCKER_PASSWORD && make dockerhub
|
||||
on:
|
||||
repo: aler9/rtsp-simple-server
|
||||
tags: true
|
||||
|
|
|
|||
101
Makefile
101
Makefile
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
.PHONY: $(shell ls)
|
||||
|
||||
BASE_IMAGE = amd64/golang:1.14-alpine3.11
|
||||
BASE_IMAGE = golang:1.14-alpine3.11
|
||||
|
||||
help:
|
||||
@echo "usage: make [action]"
|
||||
|
|
@ -13,7 +13,7 @@ help:
|
|||
@echo " test run available tests"
|
||||
@echo " run ARGS=args run app"
|
||||
@echo " release build release assets"
|
||||
@echo " travis-setup setup travis CI"
|
||||
@echo " dockerhub build and push docker hub images"
|
||||
@echo ""
|
||||
|
||||
blank :=
|
||||
|
|
@ -23,15 +23,15 @@ $(blank)
|
|||
endef
|
||||
|
||||
mod-tidy:
|
||||
docker run --rm -it -v $(PWD):/s $(BASE_IMAGE) \
|
||||
docker run --rm -it -v $(PWD):/s amd64/$(BASE_IMAGE) \
|
||||
sh -c "apk add git && cd /s && GOPROXY=direct go get && GOPROXY=direct go mod tidy"
|
||||
|
||||
format:
|
||||
docker run --rm -it -v $(PWD):/s $(BASE_IMAGE) \
|
||||
docker run --rm -it -v $(PWD):/s amd64/$(BASE_IMAGE) \
|
||||
sh -c "cd /s && find . -type f -name '*.go' | xargs gofmt -l -w -s"
|
||||
|
||||
define DOCKERFILE_TEST
|
||||
FROM $(BASE_IMAGE)
|
||||
FROM amd64/$(BASE_IMAGE)
|
||||
RUN apk add --no-cache make docker-cli git
|
||||
WORKDIR /s
|
||||
COPY go.mod go.sum ./
|
||||
|
|
@ -48,13 +48,13 @@ test:
|
|||
make test-nodocker
|
||||
|
||||
test-nodocker:
|
||||
$(eval export CGO_ENABLED=0)
|
||||
$(foreach IMG,$(shell echo test-images/*/ | xargs -n1 basename), \
|
||||
docker build -q test-images/$(IMG) -t rtsp-simple-server-test-$(IMG)$(NL))
|
||||
$(eval export CGO_ENABLED = 0)
|
||||
go test -v .
|
||||
|
||||
define DOCKERFILE_RUN
|
||||
FROM $(BASE_IMAGE)
|
||||
FROM amd64/$(BASE_IMAGE)
|
||||
RUN apk add --no-cache git
|
||||
WORKDIR /s
|
||||
COPY go.mod go.sum ./
|
||||
|
|
@ -72,7 +72,7 @@ run:
|
|||
/out $(ARGS)
|
||||
|
||||
define DOCKERFILE_RELEASE
|
||||
FROM $(BASE_IMAGE)
|
||||
FROM amd64/$(BASE_IMAGE)
|
||||
RUN apk add --no-cache zip make git tar
|
||||
WORKDIR /s
|
||||
COPY go.mod go.sum ./
|
||||
|
|
@ -88,39 +88,84 @@ release:
|
|||
temp sh -c "rm -rf /out/release && cp -r /s/release /out/"
|
||||
|
||||
release-nodocker:
|
||||
$(eval export CGO_ENABLED=0)
|
||||
$(eval VERSION := $(shell git describe --tags))
|
||||
$(eval GOBUILD := go build -ldflags '-X "main.Version=$(VERSION)"')
|
||||
$(eval GOBUILD := go build -ldflags '-X main.Version=$(VERSION)')
|
||||
rm -rf release && mkdir release
|
||||
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -o /tmp/rtsp-simple-server.exe
|
||||
GOOS=windows GOARCH=amd64 $(GOBUILD) -o /tmp/rtsp-simple-server.exe
|
||||
cd /tmp && zip -q $(PWD)/release/rtsp-simple-server_$(VERSION)_windows_amd64.zip rtsp-simple-server.exe
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o /tmp/rtsp-simple-server
|
||||
GOOS=linux GOARCH=amd64 $(GOBUILD) -o /tmp/rtsp-simple-server
|
||||
tar -C /tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_linux_amd64.tar.gz --owner=0 --group=0 rtsp-simple-server
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 $(GOBUILD) -o /tmp/rtsp-simple-server
|
||||
GOOS=linux GOARCH=arm GOARM=6 $(GOBUILD) -o /tmp/rtsp-simple-server
|
||||
tar -C /tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_linux_arm6.tar.gz --owner=0 --group=0 rtsp-simple-server
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 $(GOBUILD) -o /tmp/rtsp-simple-server
|
||||
GOOS=linux GOARCH=arm GOARM=7 $(GOBUILD) -o /tmp/rtsp-simple-server
|
||||
tar -C /tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_linux_arm7.tar.gz --owner=0 --group=0 rtsp-simple-server
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GOBUILD) -o /tmp/rtsp-simple-server
|
||||
GOOS=linux GOARCH=arm64 $(GOBUILD) -o /tmp/rtsp-simple-server
|
||||
tar -C /tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_linux_arm64.tar.gz --owner=0 --group=0 rtsp-simple-server
|
||||
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GOBUILD) -o /tmp/rtsp-simple-server
|
||||
GOOS=darwin GOARCH=amd64 $(GOBUILD) -o /tmp/rtsp-simple-server
|
||||
tar -C /tmp -czf $(PWD)/release/rtsp-simple-server_$(VERSION)_darwin_amd64.tar.gz --owner=0 --group=0 rtsp-simple-server
|
||||
|
||||
define DOCKERFILE_TRAVIS
|
||||
FROM ruby:alpine
|
||||
RUN apk add --no-cache build-base git
|
||||
RUN gem install travis
|
||||
endef
|
||||
export DOCKERFILE_TRAVIS
|
||||
define DOCKERFILE_IMAGE
|
||||
FROM --platform=linux/amd64 $(BASE_IMAGE) AS build
|
||||
RUN apk add --no-cache git
|
||||
WORKDIR /s
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . ./
|
||||
ARG VERSION
|
||||
ARG OPTS
|
||||
RUN export CGO_ENABLED=0 $${OPTS} \
|
||||
&& go build -ldflags "-X main.Version=$$VERSION" -o /rtsp-simple-server
|
||||
|
||||
travis-setup:
|
||||
echo "$$DOCKERFILE_TRAVIS" | docker build - -t temp
|
||||
docker run --rm -it \
|
||||
-v $(PWD):/s \
|
||||
temp \
|
||||
sh -c "cd /s \
|
||||
&& travis setup releases --force"
|
||||
FROM scratch
|
||||
COPY --from=build /rtsp-simple-server /rtsp-simple-server
|
||||
ENTRYPOINT [ "/rtsp-simple-server"]
|
||||
endef
|
||||
export DOCKERFILE_IMAGE
|
||||
|
||||
dockerhub:
|
||||
$(eval export DOCKER_CLI_EXPERIMENTAL=enabled)
|
||||
$(eval VERSION := $(shell git describe --tags))
|
||||
|
||||
docker buildx rm test 2>/dev/null || true
|
||||
docker buildx create --name=builder --use
|
||||
|
||||
echo "$$DOCKERFILE_IMAGE" | docker buildx build . -f - --build-arg VERSION=$(VERSION) \
|
||||
--push -t aler9/rtsp-simple-server:$(VERSION)-amd64 --build-arg OPTS="GOOS=linux GOARCH=amd64" --platform=linux/amd64
|
||||
|
||||
echo "$$DOCKERFILE_IMAGE" | docker buildx build . -f - --build-arg VERSION=$(VERSION) \
|
||||
--push -t aler9/rtsp-simple-server:$(VERSION)-armv6 --build-arg OPTS="GOOS=linux GOARCH=arm GOARM=6" --platform=linux/arm/v6
|
||||
|
||||
echo "$$DOCKERFILE_IMAGE" | docker buildx build . -f - --build-arg VERSION=$(VERSION) \
|
||||
--push -t aler9/rtsp-simple-server:$(VERSION)-armv7 --build-arg OPTS="GOOS=linux GOARCH=arm GOARM=7" --platform=linux/arm/v7
|
||||
|
||||
echo "$$DOCKERFILE_IMAGE" | docker buildx build . -f - --build-arg VERSION=$(VERSION) \
|
||||
--push -t aler9/rtsp-simple-server:$(VERSION)-arm64 --build-arg OPTS="GOOS=linux GOARCH=arm64" --platform=linux/arm64/v8
|
||||
|
||||
docker manifest create --amend aler9/rtsp-simple-server:$(VERSION) \
|
||||
$(foreach ARCH,amd64 armv6 armv7 arm64,aler9/rtsp-simple-server:$(VERSION)-$(ARCH))
|
||||
docker manifest push aler9/rtsp-simple-server:$(VERSION)
|
||||
|
||||
echo "$$DOCKERFILE_IMAGE" | docker buildx build . -f - --build-arg VERSION=$(VERSION) \
|
||||
--push -t aler9/rtsp-simple-server:latest-amd64 --build-arg OPTS="GOOS=linux GOARCH=amd64" --platform=linux/amd64
|
||||
|
||||
echo "$$DOCKERFILE_IMAGE" | docker buildx build . -f - --build-arg VERSION=$(VERSION) \
|
||||
--push -t aler9/rtsp-simple-server:latest-armv6 --build-arg OPTS="GOOS=linux GOARCH=arm GOARM=6" --platform=linux/arm/v6
|
||||
|
||||
echo "$$DOCKERFILE_IMAGE" | docker buildx build . -f - --build-arg VERSION=$(VERSION) \
|
||||
--push -t aler9/rtsp-simple-server:latest-armv7 --build-arg OPTS="GOOS=linux GOARCH=arm GOARM=7" --platform=linux/arm/v7
|
||||
|
||||
echo "$$DOCKERFILE_IMAGE" | docker buildx build . -f - --build-arg VERSION=$(VERSION) \
|
||||
--push -t aler9/rtsp-simple-server:latest-arm64 --build-arg OPTS="GOOS=linux GOARCH=arm64" --platform=linux/arm64/v8
|
||||
|
||||
docker manifest create --amend aler9/rtsp-simple-server:latest \
|
||||
$(foreach ARCH,amd64 armv6 armv7 arm64,aler9/rtsp-simple-server:latest-$(ARCH))
|
||||
docker manifest push aler9/rtsp-simple-server:latest
|
||||
|
||||
docker buildx rm builder
|
||||
|
|
|
|||
15
README.md
15
README.md
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
[](https://goreportcard.com/report/github.com/aler9/rtsp-simple-server)
|
||||
[](https://travis-ci.org/aler9/rtsp-simple-server)
|
||||
[](https://hub.docker.com/r/aler9/rtsp-simple-server)
|
||||
|
||||
_rtsp-simple-server_ is a simple, ready-to-use and zero-dependency RTSP server, a software that allows multiple users to publish and read live video and audio streams. RTSP is a standardized protocol that defines how to perform these operations with the help of a server, that is contacted by both readers and publishers in order to negotiate a streaming protocol. The server is then responsible of relaying the publisher streams to the readers.
|
||||
|
||||
|
|
@ -48,7 +49,19 @@ Features:
|
|||
|
||||
## Advanced usage and FAQs
|
||||
|
||||
#### Setup publisher authentication
|
||||
#### Usage with Docker
|
||||
|
||||
Download and launch the image:
|
||||
```
|
||||
docker run --rm -it --network=host aler9/rtsp-simple-server
|
||||
```
|
||||
|
||||
The `--network=host` argument is mandatory since Docker can change the source port of UDP packets for routing reasons, and this makes RTSP routing impossible. An alternative consists in disabling UDP and exposing the RTSP port:
|
||||
```
|
||||
docker run --rm -it -p 8554 aler9/rtsp-simple-server --protocols=tcp
|
||||
```
|
||||
|
||||
#### Publisher authentication
|
||||
|
||||
Start the server and set a username and a password:
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue