Merge pull request #746 from tyranron/docker-image

Official Docker image
This commit is contained in:
Mészáros Mihály 2021-04-14 19:32:38 +02:00 committed by GitHub
commit 1a62db5e30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 1269 additions and 207 deletions

19
.dockerignore Normal file
View File

@ -0,0 +1,19 @@
*
!docker/coturn/alpine/
!docker/coturn/debian/
!cmake/
!CMakeLists.txt
!configure
!examples/
!INSTALL
!LICENSE
!LICENSE.OpenSSL
!make-man.sh
!Makefile.in
!man/
!postinstall.txt
!README.turn*
!src/
!turndb/

171
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,171 @@
name: Docker CI
on:
pull_request:
push:
schedule:
- cron: '13 13 * * 3'
jobs:
buildx:
strategy:
matrix:
include:
- dockerfile: debian
cache: ${{ github.ref != 'refs/heads/master'
&& !startsWith(github.ref, 'refs/tags/docker/') }}
publish: ${{ github.event_name == 'push'
&& (startsWith(github.ref, 'refs/tags/docker/')
|| github.ref == 'refs/heads/master') }}
release: ${{ github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags/docker/') }}
- dockerfile: alpine
cache: ${{ github.ref != 'refs/heads/master'
&& !startsWith(github.ref, 'refs/tags/docker/') }}
publish: ${{ github.event_name == 'push'
&& (startsWith(github.ref, 'refs/tags/docker/')
|| github.ref == 'refs/heads/master') }}
release: ${{ github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags/docker/') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- name: Detect correct Git ref for image build
id: git
uses: actions/github-script@v3
with:
script: |
let out = {ref: 'HEAD', ver: ''};
if ('${{ github.ref }}'.startsWith('refs/tags/docker/')) {
out.ref = '${{ github.ref }}'.substring(17).split('-')[0];
out.ver = out.ref;
}
return out;
- name: Pre-build fresh Docker images cache
run: make docker.build.cache no-cache=yes
DOCKERFILE=${{ matrix.dockerfile }}
ref=${{ fromJSON(steps.git.outputs.result).ref }}
working-directory: ./docker/coturn
if: ${{ !matrix.cache }}
- uses: satackey/action-docker-layer-caching@v0.0.11
with:
key: docker-${{ matrix.dockerfile }}-buildx-{hash}
restore-keys: docker-${{ matrix.dockerfile }}-buildx-
continue-on-error: true
timeout-minutes: 10
if: ${{ matrix.cache }}
- name: Pre-build Docker images cache
run: make docker.build.cache no-cache=no
DOCKERFILE=${{ matrix.dockerfile }}
ref=${{ fromJSON(steps.git.outputs.result).ref }}
working-directory: ./docker/coturn
if: ${{ matrix.cache }}
- name: Test Docker images
run: |
# Enable experimental features of Docker Daemon to run multi-arch images.
echo "$(cat /etc/docker/daemon.json)" '{"experimental": true}' \
| jq --slurp 'reduce .[] as $item ({}; . * $item)' \
| sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
make npm.install
make test.docker platforms=@all build=yes \
DOCKERFILE=${{ matrix.dockerfile }} \
ref=${{ fromJSON(steps.git.outputs.result).ref }}
env:
COTURN_VERSION: ${{ fromJSON(steps.git.outputs.result).ver }}
working-directory: ./docker/coturn
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GCR_BOT_PAT }}
if: ${{ matrix.publish }}
- name: Login to Quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAYIO_ROBOT_USERNAME }}
password: ${{ secrets.QUAYIO_ROBOT_TOKEN }}
if: ${{ matrix.publish }}
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_BOT_USER }}
password: ${{ secrets.DOCKERHUB_BOT_PASS }}
if: ${{ matrix.publish }}
- name: Publish version Docker tags
run: make docker.push
DOCKERFILE=${{ matrix.dockerfile }}
ref=${{ fromJSON(steps.git.outputs.result).ref }}
working-directory: ./docker/coturn
if: ${{ matrix.release }}
- name: Publish edge Docker tags
run: make docker.push tags=edge-${{ matrix.dockerfile }}
DOCKERFILE=${{ matrix.dockerfile }}
ref=${{ fromJSON(steps.git.outputs.result).ref }}
working-directory: ./docker/coturn
if: ${{ matrix.publish && !matrix.release }}
# On GitHub Container Registry README is automatically updated on pushes.
- name: Update README on Quay.io
uses: christian-korneck/update-container-description-action@v1
env:
DOCKER_APIKEY: ${{ secrets.QUAYIO_API_TOKEN }}
with:
provider: quay
destination_container_repo: quay.io/coturn/coturn
readme_file: docker/coturn/README.md
if: ${{ matrix.publish }}
- name: Update README on Docker Hub
uses: christian-korneck/update-container-description-action@v1
env:
DOCKER_USER: ${{ secrets.DOCKERHUB_BOT_USER }}
DOCKER_PASS: ${{ secrets.DOCKERHUB_BOT_PASS }}
with:
provider: dockerhub
destination_container_repo: coturn/coturn
readme_file: docker/coturn/README.md
if: ${{ matrix.publish }}
- name: Parse release version from Git tag
id: release
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/docker/}
if: ${{ matrix.release }}
- name: Parse CHANGELOG link
id: changelog
run: echo ::set-output name=LINK::https://github.com/${{ github.repository }}/blob/docker/${{ steps.release.outputs.VERSION }}/docker/coturn/CHANGELOG.md#$(sed -n '/^## \[${{ steps.release.outputs.VERSION }}\]/{s/^## \[\(.*\)\][^0-9]*\([0-9].*\)/\1--\2/;s/[^0-9a-z-]*//g;p;}' CHANGELOG.md)
working-directory: ./docker/coturn
if: ${{ matrix.release }}
- name: Release on GitHub
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: docker/${{ steps.release.outputs.VERSION }}
release_name: ${{ steps.release.outputs.VERSION }}
body: |
[Changelog](${{ steps.changelog.outputs.LINK }})
if: ${{ matrix.release }}

6
.gitignore vendored
View File

@ -1,5 +1,5 @@
Makefile
bin
/Makefile
/bin/
build
include
lib
@ -32,7 +32,7 @@ tags
.DS_Store
.directory
*.debug
Makefile*
/Makefile*
*.prl
*.app
moc_*.cpp

View File

@ -19,8 +19,6 @@ Version 4.5.3 'dan Eider':
* Packaging scripts can miss out on these errors (exit code)
- merge PR #679 (by rubo77)
* Readme.turnserver: how to run server as a daemon
- merge PR # #718 (by dcharbonnier)
* mongoc version 1.17.4
10/01/2021 Oleg Moskalenko <mom040267@gmail.com> Mihály Mészáros <misi@majd.eu>
Version 4.5.2 'dan Eider':

7
docker/coturn/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
/node_modules/
/package-lock.json
/yarn.lock
/yarn-error.log
/сert.pem
/privkey.pem

View File

@ -0,0 +1,31 @@
Coturn TURN server Docker image changelog
=========================================
## [4.5.2-r0] · 2021-04-?? · To-be-done
[4.5.2-r0]: /../../tree/docker/4.5.2-r0
### Created
- [Coturn] 4.5.2: <https://github.com/coturn/coturn/blob/upstream/4.5.2/ChangeLog>
- [Alpine Linux] 3.13: <https://alpinelinux.org/posts/Alpine-3.13.0-released.html>
- [Debian Linux] "buster": <https://www.debian.org/releases/buster/releasenotes>
- [mongo-c-driver] 1.17.5 (`debian` only): <https://github.com/mongodb/mongo-c-driver/releases/tag/1.17.5>
- Supported platforms:
- `linux/amd64`
- `linux/arm64`
- `linux/arm/v6`
- `linux/arm/v7`
- `linux/ppc64le`
- `linux/s390x`
[Alpine Linux]: https://www.alpinelinux.org
[Coturn]: https://haraka.github.io
[Debian Linux]: https://www.debian.org
[mongo-c-driver]: https://github.com/mongodb/mongo-c-driver

View File

@ -0,0 +1,65 @@
Contribution Guide
==================
## Best practices
1. Keep the image size as small as possible:
- Do not produce redundant layers in the final image.
- Cleanup temporary files and caches in the same layer were they were produced.
- Remove unnecessary man pages, examples and documentation.
2. Build each project in its separate stage:
- Do use layers granularly in non-final stages for better caching of build results.
- Prepare all the final files as much as possible in their build stage before adding them to the final stage.
## CI workflow
At the moment `coturn/coturn` Docker image's [workflow is automated][1] via [GitHub Actions] in the following manner:
- On each push the image is built and tested.
This helps to track image regressions due to changes in codebase.
- Image is built and tested automatically from `master` branch on weekly basis.
This helps to track image regressions due to changes in parent OS images (`debian`, `alpine`), their system packages, and other dependencies.
- On each push to `master` branch the image is published with `edge-debian` and `edge-alpine` tags.
This helps to test and try the latest `master` branch and its changes for whoever needs this.
- On each `docker/X.Y.Z-rN` tag creation the image is built using the `X.Y.Z` Coturn version (not the local sources), tested, and is published with all the version tags declared in [`Makefile`] (see `ALL_IMAGES`).
An appropriate [GitHub Release] for the `docker/X.Y.Z-rN` Git tag is also created automatically.
- Whenever the image is published, its description on container registries is automatically updated with its [README] file.
## Releasing
To produce a new release (version tag) of `coturn/coturn` Docker image, perform the following steps:
1. Upgrade the image version correctly in [`Makefile`] by bumping up either the `COTURN_VER` (if Coturn has changed it version) or the `BUILD_REV` (if anything else in the image has been changed). If the `COTURN_VER` has changed, the `BUILD_REV` may be reset to `0`.
2. Complete an existing [CHANGELOG] or fill up a new one for the new version declared in [`Makefile`].
3. Update [README] with the new version declared in [`Makefile`].
4. Perform a `make release` command inside the`docker/coturn/` directory.
[CHANGELOG]: https://github.com/coturn/coturn/blob/master/docker/coturn/CHANGELOG.md
[GitHub Actions]: https://docs.github.com/actions
[GitHub Release]: https://github.com/coturn/coturn/releases
[README]: https://github.com/coturn/coturn/blob/master/docker/coturn/README.md
[`Makefile`]: https://github.com/coturn/coturn/blob/master/docker/coturn/Makefile
[1]: https://github.com/coturn/coturn/blob/master/.github/workflows/docker.yml

View File

@ -1,154 +0,0 @@
### 1. stage: create mongoc image
FROM debian:stable-slim AS mongoc-build
ENV MONGO_LIB_VERSION 1.17.4
# Install build dependencies
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y build-essential git python cmake
RUN apt-get install -y libssl-dev
RUN git clone https://github.com/mongodb/mongo-c-driver.git && \
cd mongo-c-driver && \
git checkout ${MONGO_LIB_VERSION} && \
python build/calc_release_version.py > VERSION_CURRENT && \
mkdir -p cmake-build/install && \
cd cmake-build && \
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DCMAKE_BUILD_TYPE=Release .. && \
DESTDIR=/mongo-c-driver/cmake-build/install cmake --build . --target install
RUN cd /mongo-c-driver/cmake-build/install && tar -cf /mongoc.tar .
### 2. stage: create build image
FROM debian:stable-slim AS coturn-build
ENV BUILD_PREFIX /usr/local/src
# Install build dependencies
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y build-essential git debhelper dpkg-dev pkg-config libssl-dev libevent-dev sqlite3 libsqlite3-dev postgresql-client libpq-dev default-mysql-client default-libmysqlclient-dev libhiredis-dev libsystemd-dev
COPY --from=mongoc-build /mongoc.tar /tmp
RUN tar -xf /tmp/mongoc.tar -C /
# Clone Coturn
WORKDIR ${BUILD_PREFIX}
RUN git clone https://github.com/coturn/coturn.git
# Build Coturn
WORKDIR ${BUILD_PREFIX}/coturn
RUN ./configure
RUN make
### 3. stage: create production image
FROM debian:stable-slim AS production
ENV INSTALL_PREFIX /usr/local
ENV BUILD_PREFIX /usr/local/src
ENV TURNSERVER_GROUP turnserver
ENV TURNSERVER_USER turnserver
COPY --from=coturn-build ${BUILD_PREFIX}/coturn/bin/ ${INSTALL_PREFIX}/bin/
COPY --from=coturn-build ${BUILD_PREFIX}/coturn/man/ ${INSTALL_PREFIX}/man/
#COPY turnserver.conf ${INSTALL_PREFIX}/etc
COPY --from=coturn-build ${BUILD_PREFIX}/coturn/sqlite/turndb ${INSTALL_PREFIX}/var/db/turndb
COPY --from=coturn-build ${BUILD_PREFIX}/coturn/turndb ${INSTALL_PREFIX}/turndb
COPY --from=mongoc-build /mongoc.tar /tmp
RUN tar -xf /tmp/mongoc.tar -C / && rm /tmp/mongoc.tar
# Install lib dependencies
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y libc6 libsasl2-2 libevent-2.1 libevent-core-2.1-6 libevent-extra-2.1-6 libevent-openssl-2.1-6 libevent-pthreads-2.1-6 libhiredis0.14 libmariadbclient-dev libpq5 libsqlite3-0 libssl1.1 && \
apt-get clean && rm -f /var/lib/apt/lists/*_*
RUN if ! getent group "$TURNSERVER_GROUP" >/dev/null; then \
addgroup --system "$TURNSERVER_GROUP" || exit 1 ;\
fi \
&& \
if ! getent passwd "$TURNSERVER_USER" >/dev/null; then \
adduser --system \
--home / \
--shell /bin/false \
--no-create-home \
--ingroup "$TURNSERVER_GROUP" \
--disabled-password \
--disabled-login \
--gecos "turnserver daemon" \
"$TURNSERVER_USER" || exit 1; \
fi
WORKDIR ${INSTALL_PREFIX}
CMD ${INSTALL_PREFIX}/bin/turnserver
### 4. stage: create testing
FROM debian:stable-slim as coturn
ENV INSTALL_PREFIX /usr/local
ENV BUILD_PREFIX /usr/local/src
ENV TURNSERVER_GROUP turnserver
ENV TURNSERVER_USER turnserver
COPY --from=coturn-build ${BUILD_PREFIX}/coturn/bin/ ${INSTALL_PREFIX}/bin/
COPY --from=coturn-build ${BUILD_PREFIX}/coturn/man/ ${INSTALL_PREFIX}/man/
#COPY turnserver.conf ${INSTALL_PREFIX}/etc
COPY --from=coturn-build ${BUILD_PREFIX}/coturn/sqlite/turndb ${INSTALL_PREFIX}/var/db/turndb
COPY --from=coturn-build ${BUILD_PREFIX}/coturn/turndb ${INSTALL_PREFIX}/turndb
COPY --from=mongoc-build /mongoc.tar /tmp
RUN tar -xf /tmp/mongoc.tar -C / && rm /tmp/mongoc.tar
# Install lib dependencies
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y libc6 libsasl2-2 libevent-2.1 libevent-core-2.1-6 libevent-extra-2.1-6 libevent-openssl-2.1-6 libevent-pthreads-2.1-6 libhiredis0.14 libmariadbclient-dev libpq5 libsqlite3-0 libssl1.1
RUN apt-get install -y default-mysql-client postgresql-client redis-tools
# Workaround for MongoDB
RUN ln -s /bin/echo /bin/systemctl
# Install MongoDB
RUN apt-get update && \
apt-get install -y wget gnupg && \
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add - && \
echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.4 main" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list && \
echo "deb http://deb.debian.org/debian/ stretch main" | tee /etc/apt/sources.list.d/debian-stretch.list && \
apt-get update && \
apt-get install -y libcurl3 mongodb-org mongodb-org-server mongodb-org
RUN if ! getent group "$TURNSERVER_GROUP" >/dev/null; then \
addgroup --system "$TURNSERVER_GROUP" || exit 1 ;\
fi \
&& \
if ! getent passwd "$TURNSERVER_USER" >/dev/null; then \
adduser --system \
--home / \
--shell /bin/false \
--no-create-home \
--ingroup "$TURNSERVER_GROUP" \
--disabled-password \
--disabled-login \
--gecos "turnserver daemon" \
"$TURNSERVER_USER" || exit 1; \
fi
# set startup parameters
# SUTN/TURN PORTS
EXPOSE 3478 3479 3478/udp 3479/udp 80 80/udp
EXPOSE 5349 5350 5349/udp 5350/udp 443 443/udp
# CLI
EXPOSE 5766
# Relay Ports
EXPOSE 49152-65535 49152-65535/udp
#COPY ./docker-entrypoint.sh /
#ENTRYPOINT ["/docker-entrypoint.sh"]
WORKDIR ${INSTALL_PREFIX}
CMD ${INSTALL_PREFIX}/bin/turnserver

255
docker/coturn/Makefile Normal file
View File

@ -0,0 +1,255 @@
###############################
# Common defaults/definitions #
###############################
comma := ,
empty :=
space := $(empty) $(empty)
# Checks two given strings for equality.
eq = $(if $(or $(1),$(2)),$(and $(findstring $(1),$(2)),\
$(findstring $(2),$(1))),1)
######################
# Project parameters #
######################
COTURN_VER ?= 4.5.2
COTURN_MIN_VER = $(strip $(shell echo $(COTURN_VER) | cut -d '.' -f1,2))
COTURN_MAJ_VER = $(strip $(shell echo $(COTURN_VER) | cut -d '.' -f1))
BUILD_REV ?= 0
NAMESPACES := coturn \
ghcr.io/coturn
NAME := coturn
ALL_IMAGES := \
debian:$(COTURN_VER)-r$(BUILD_REV)-debian,$(COTURN_VER)-debian,$(COTURN_MIN_VER)-debian,$(COTURN_MAJ_VER)-debian,debian,$(COTURN_VER)-r$(BUILD_REV),$(COTURN_VER),$(COTURN_MIN_VER),$(COTURN_MAJ_VER),latest \
alpine:$(COTURN_VER)-r$(BUILD_REV)-alpine,$(COTURN_VER)-alpine,$(COTURN_MIN_VER)-alpine,$(COTURN_MAJ_VER)-alpine,alpine
# <Dockerfile>:<version>,<tag1>,<tag2>,...
# Default is first image from ALL_IMAGES list.
DOCKERFILE ?= $(word 1,$(subst :, ,$(word 1,$(ALL_IMAGES))))
TAGS ?= $(word 1,$(subst |, ,\
$(word 2,!$(subst $(DOCKERFILE):, ,$(subst $(space),|,$(ALL_IMAGES))))))
VERSION ?= $(word 1,$(subst -, ,$(TAGS)))-$(word 2,$(strip \
$(subst -, ,$(subst $(comma), ,$(TAGS)))))
PLATFORMS ?= linux/amd64 \
linux/arm64 \
linux/arm/v6 \
linux/arm/v7 \
linux/ppc64le \
linux/s390x
MAIN_PLATFORM ?= $(word 1,$(subst $(comma), ,$(PLATFORMS)))
###########
# Aliases #
###########
image: docker.image
push: docker.push
release: git.release
test: test.docker
###################
# Docker commands #
###################
docker-namespaces = $(strip $(if $(call eq,$(namespaces),),\
$(NAMESPACES),$(subst $(comma), ,$(namespaces))))
docker-tags = $(strip $(if $(call eq,$(tags),),\
$(TAGS),$(subst $(comma), ,$(tags))))
docker-platforms = $(strip $(if $(call eq,$(platforms),),\
$(PLATFORMS),$(subst $(comma), ,$(platforms))))
# Runs `docker buildx build` command allowing to customize it for the purpose of
# re-tagging or pushing.
define docker.buildx
$(eval dockerfile := $(strip $(1)))
$(eval namespace := $(strip $(2)))
$(eval tag := $(strip $(3)))
$(eval git-ref := $(strip $(4)))
$(eval platform := $(strip $(5)))
$(eval no-cache := $(strip $(6)))
$(eval args := $(strip $(7)))
cd ../../ && \
docker buildx build --force-rm $(args) \
--platform $(platform) \
$(if $(call eq,$(no-cache),yes),--no-cache --pull,) \
$(if $(call eq,$(git-ref),),,--build-arg git_ref=$(git-ref)) \
-f docker/coturn/$(dockerfile)/Dockerfile \
-t $(namespace)/$(NAME):$(tag) ./
endef
# Pre-build cache for Docker image builds.
#
# WARNING: This command doesn't apply tag to the built Docker image, just
# creates a build cache. To produce a Docker image with a tag, use
# `docker.tag` command right after running this one.
#
# Usage:
# make docker.build.cache [DOCKERFILE=(debian|alpine)]
# [platforms=($(PLATFORMS)|<platform-1>[,<platform-2>...])]
# [no-cache=(no|yes)]
# [ref=<git-ref>]
docker.build.cache:
$(call docker.buildx,$(DOCKERFILE),\
instrumentisto,\
build-cache,\
$(ref),\
$(shell echo "$(docker-platforms)" | tr -s '[:blank:]' ','),\
$(no-cache),\
--output 'type=image$(comma)push=false')
# Build Docker image on the given platform with the given tag.
#
# Usage:
# make docker.image [DOCKERFILE=(debian|alpine)]
# [tag=($(VERSION)|<tag>)]
# [platform=($(MAIN_PLATFORM)|<platform>)]
# [no-cache=(no|yes)]
# [ref=<git-ref>]
docker.image:
$(call docker.buildx,$(DOCKERFILE),\
instrumentisto,\
$(if $(call eq,$(tag),),$(VERSION),$(tag)),\
$(ref),\
$(if $(call eq,$(platform),),$(MAIN_PLATFORM),$(platform)),\
$(no-cache),\
--load)
# Push Docker images to their repositories (container registries),
# along with the required multi-arch manifests.
#
# Usage:
# make docker.push [DOCKERFILE=(debian|alpine)]
# [namespaces=($(NAMESPACES)|<prefix-1>[,<prefix-2>...])]
# [tags=($(TAGS)|<tag-1>[,<tag-2>...])]
# [platforms=($(PLATFORMS)|<platform-1>[,<platform-2>...])]
# [ref=<git-ref>]
docker.push:
$(foreach namespace,$(docker-namespaces),\
$(foreach tag,$(docker-tags),\
$(call docker.buildx,$(DOCKERFILE),\
$(namespace),\
$(tag),\
$(ref),\
$(shell echo "$(docker-platforms)" | tr -s '[:blank:]' ','),,\
--push)))
####################
# Testing commands #
####################
# Run Bats tests for Docker image.
#
# Documentation of Bats:
# https://github.com/bats-core/bats-core
#
# Usage:
# make test.docker
# [tag=($(VERSION)|<tag>)]
# [platforms=($(MAIN_PLATFORM)|@all|<platform-1>[,<platform-2>...])]
# [( [build=no]
# | build=yes [DOCKERFILE=(debian|alpine)]
# [ref=<git-ref>] )]
test-docker-platforms = $(strip $(if $(call eq,$(platforms),),$(MAIN_PLATFORM),\
$(if $(call eq,$(platforms),@all),$(PLATFORMS),\
$(docker-platforms))))
test.docker:
ifeq ($(wildcard node_modules/.bin/bats),)
@make npm.install
endif
$(foreach platform,$(test-docker-platforms),\
$(call test.docker.do,\
$(if $(call eq,$(tag),),$(VERSION),$(tag)),\
$(platform)))
define test.docker.do
$(eval tag := $(strip $(1)))
$(eval platform := $(strip $(2)))
$(if $(call eq,$(build),yes),\
@make docker.image DOCKERFILE=$(DOCKERFILE) \
no-cache=no tag=$(tag) platform=$(platform) ref=$(ref) ,)
IMAGE=instrumentisto/$(NAME):$(tag) PLATFORM=$(platform) \
node_modules/.bin/bats \
--timing $(if $(call eq,$(CI),),--pretty,--formatter tap) \
tests/main.bats
endef
################
# NPM commands #
################
# Resolve project NPM dependencies.
#
# Usage:
# make npm.install [dockerized=(no|yes)]
npm.install:
ifeq ($(dockerized),yes)
docker run --rm --network=host -v "$(PWD)":/app/ -w /app/ \
node \
make npm.install dockerized=no
else
npm install
endif
################
# Git commands #
################
# Release project version (apply version tag and push).
#
# Usage:
# make git.release [ver=($(VERSION)|<proj-ver>)]
git-release-tag = docker/$(strip $(if $(call eq,$(ver),),$(VERSION),$(ver)))
git.release:
ifeq ($(shell git rev-parse $(git-release-tag) >/dev/null 2>&1 && echo "ok"),ok)
$(error "Git tag $(git-release-tag) already exists")
endif
git tag $(git-release-tag)
git push origin refs/tags/$(git-release-tag)
##################
# .PHONY section #
##################
.PHONY: image push release test \
docker.build.cache docker.image docker.push \
git.release \
npm.install \
test.docker

201
docker/coturn/README.md Normal file
View File

@ -0,0 +1,201 @@
Coturn TURN server Docker image
===============================
[![CI](https://github.com/coturn/coturn/workflows/docker/badge.svg?branch=master "CI")](https://github.com/coturn/coturn/actions?query=workflow%3Adocker+branch%3Amaster)
[![Docker Hub](https://img.shields.io/docker/pulls/coturn/coturn?label=Docker%20Hub%20pulls "Docker Hub pulls")](https://hub.docker.com/r/coturn/coturn)
[Docker Hub](https://hub.docker.com/r/coturn/coturn)
| [GitHub Container Registry](https://github.com/orgs/coturn/packages/container/package/coturn)
| [Quay.io](https://quay.io/repository/coturn/coturn)
[Changelog](https://github.com/coturn/coturn/blob/master/docker/coturn/CHANGELOG.md)
## Supported tags and respective `Dockerfile` links
- [`4.5.2-r0`, `4.5.2-r0-debian`, `4.5.2`, `4.5.2-debian`, `4.5`, `4.5-debian`, `4`, `4-debian`, `debian`, `latest`][d1]
- [`4.5.2-r0-alpine`, `4.5.2-alpine`, `4.5-alpine`, `4-alpine`, `alpine`][d2]
## Supported platforms
- `linux/amd64`
- `linux/arm64`
- `linux/arm/v6`
- `linux/arm/v7`
- `linux/ppc64le`
- `linux/s390x`
## What is Coturn TURN server?
The TURN Server is a VoIP media traffic NAT traversal server and gateway. It can be used as a general-purpose network traffic TURN server and gateway, too.
> [github.com/coturn/coturn](https://github.com/coturn/coturn)
## How to use this image
To run Coturn TURN server just start the container:
```bash
docker run -d -p 3478:3478 -p 49152-65535:49152-65535/udp coturn/coturn
```
### Why so many ports opened?
As per [RFC 5766 Section 6.2], these are the ports that the TURN server will use to exchange media.
You can change them with `min-port` and `max-port` Coturn configuration options:
```bash
docker run -d -p 3478:3478 -p 49160-49200:49160-49200/udp \
coturn/coturn -n --log-file=stdout \
--external-ip='$(detect-external-ip)' \
--min-port=49160 --max-port=49200
```
Or just use the host network directly (__recommended__, as Docker [performs badly with large port ranges][7]):
```bash
docker run -d --network=host coturn/coturn
```
### Configuration
By default, default Coturn configuration and CLI options provided in the `CMD` [Dockerfile][d1] instruction are used.
1. You may either specify your own configuration file instead.
```bash
docker run -d --network=host \
-v $(pwd)/my.conf:/etc/coturn/turnserver.conf \
coturn/coturn
```
2. Or specify command line options directly.
```bash
docker run -d --network=host coturn/coturn \
-n --log-file=stdout \
--min-port=49160 --max-port=49200 \
--lt-cred-mech --fingerprint \
--no-multicast-peers --no-cli \
--no-tlsv1 --no-tlsv1_1 \
--realm=my.realm.org \
```
3. Or even specify another configuration file.
```bash
docker run -d --network=host \
-v $(pwd)/my.conf:/my/coturn.conf \
coturn/coturn -c /my/coturn.conf
```
#### Automatic detection of external IP
`detect-external-ip` binary may be used to automatically detect external IP of TURN server in runtime. It's okay to use it multiple times (the value will be evaluated only once).
```bash
docker run -d --network=host coturn/coturn \
-n --log-file=stdout \
--external-ip='$(detect-external-ip)' \
--relay-ip='$(detect-external-ip)'
```
### Persistence
By default, Coturn Docker image persists its data in `/var/lib/coturn/` directory.
You can speedup Coturn simply by using tmpfs for that:
```bash
docker run -d --network=host --mount type=tmpfs,destination=/var/lib/coturn coturn/coturn
```
## Image versions
### `X`
Latest tag of `X` Coturn's major version.
### `X.Y`
Latest tag of `X` Coturn's minor version.
### `X.Y.Z` or `X.Y.Z.W`
Latest tag version of a concrete `X.Y.Z` or `X.Y.Z.W` version of Coturn.
### `X.Y.Z-rN` or `X.Y.Z.W-rN`
Concrete `N` image revision tag of a Coturn's concrete `X.Y.Z` or `X.Y.Z.W` version.
Once build, it's never updated.
### `alpine`
This image is based on the popular [Alpine Linux project][1], available in [the alpine official image][2]. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use [musl libc][4] instead of [glibc and friends][5], so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See [this Hacker News comment thread][6] for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.
### `edge`
Contains build of Coturn's latest `master` branch.
## License
Coturn and its Docker images are licensed under [this license][90].
As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
## Issues
We can't notice comments in the [DockerHub] (or other container registries) so don't use them for reporting issue or asking question.
If you have any problems with or questions about this image, please contact us through a [GitHub issue][3].
[DockerHub]: https://hub.docker.com
[RFC 5766 Section 6.2]: https://tools.ietf.org/html/rfc5766.html#section-6.2
[1]: http://alpinelinux.org
[2]: https://hub.docker.com/_/alpine
[3]: https://github.com/coturn/coturn/issues
[4]: http://www.musl-libc.org
[5]: http://www.etalabs.net/compare_libcs.html
[6]: https://news.ycombinator.com/item?id=10782897
[7]: https://github.com/instrumentisto/coturn-docker-image/issues/3
[90]: https://github.com/coturn/coturn/blob/master/LICENSE
[d1]: https://github.com/coturn/coturn/blob/master/docker/coturn/debian/Dockerfile
[d2]: https://github.com/coturn/coturn/blob/master/docker/coturn/alpine/Dockerfile

View File

@ -0,0 +1,133 @@
#
# Dockerfile of coturn/coturn:alpine Docker image.
#
ARG alpine_ver=3.13
#
# Stage 'dist-coturn' creates Coturn distribution.
#
# https://hub.docker.com/_/alpine
FROM alpine:${alpine_ver} AS dist-coturn
# Install tools for building.
RUN apk update \
&& apk add --no-cache \
autoconf ca-certificates coreutils g++ git libtool make \
&& update-ca-certificates
# Install Coturn build dependencies.
RUN apk add --no-cache \
linux-headers \
libevent-dev \
openssl-dev \
postgresql-dev mariadb-connector-c-dev sqlite-dev \
hiredis-dev \
mongo-c-driver-dev
# Prepare local Coturn sources for building.
COPY CMakeLists.txt \
configure \
INSTALL \
LICENSE LICENSE.OpenSSL \
make-man.sh Makefile.in \
postinstall.txt \
README.turn* \
/app/
COPY cmake/ /app/cmake/
COPY examples/ /app/examples/
COPY man/ /app/man/
COPY src/ /app/src/
COPY turndb/ /app/turndb/
WORKDIR /app/
# Use Coturn sources from Git if `coturn_git_ref` is specified.
ARG coturn_git_ref=HEAD
RUN if [ "${coturn_git_ref}" != 'HEAD' ]; then true \
&& rm -rf /app/* \
&& git init \
&& git remote add origin https://github.com/coturn/coturn \
&& git fetch --depth=1 origin "${coturn_git_ref}" \
&& git checkout FETCH_HEAD \
&& true; fi
# Build Coturn from sources.
RUN ./configure --prefix=/usr \
--turndbdir=/var/lib/coturn \
--disable-rpath \
--sysconfdir=/etc/coturn \
# No documentation included to keep image size smaller.
--mandir=/tmp/coturn/man \
--docsdir=/tmp/coturn/docs \
--examplesdir=/tmp/coturn/examples \
&& make
# Install and configure Coturn.
RUN mkdir -p /out/ \
&& DESTDIR=/out make install \
# Remove redundant files.
&& rm -rf /out/tmp/ \
# Preserve license file.
&& mkdir -p /out/usr/share/licenses/coturn/ \
&& cp LICENSE /out/usr/share/licenses/coturn/ \
# Remove default config file.
&& rm -f /out/etc/coturn/turnserver.conf.default
# Install helper tools of Docker image.
COPY docker/coturn/alpine/rootfs/ /out/
RUN chmod +x /out/usr/local/bin/docker-entrypoint.sh \
/out/usr/local/bin/detect-external-ip.sh
RUN ln -s /usr/local/bin/detect-external-ip.sh \
/out/usr/local/bin/detect-external-ip
RUN chown -R nobody:nogroup /out/var/lib/coturn/
#
# Stage 'runtime' creates final Docker image to use in runtime.
#
# https://hub.docker.com/_/alpine
FROM alpine:${alpine_ver} AS runtime
LABEL org.opencontainers.image.source="https://github.com/coturn/coturn"
# Update system packages.
RUN apk update \
&& apk upgrade \
&& apk add --no-cache ca-certificates \
&& update-ca-certificates \
# Install Coturn dependencies.
&& apk add --no-cache \
libevent \
libcrypto1.1 libssl1.1 \
libpq mariadb-connector-c sqlite-libs \
hiredis \
mongo-c-driver \
# Cleanup unnecessary stuff.
&& rm -rf /var/cache/apk/*
# Install Coturn distribution.
COPY --from=dist-coturn /out/ /
# Allow non-root using privileged ports.
RUN apk add --no-cache libcap \
&& setcap CAP_NET_BIND_SERVICE=+ep /usr/bin/turnserver \
# Cleanup unnecessary stuff.
&& apk del libcap \
&& rm -rf /var/cache/apk/*
USER nobody:nogroup
EXPOSE 3478 3478/udp
VOLUME ["/var/lib/coturn"]
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["--log-file=stdout", "--external-ip=$(detect-external-ip)"]

View File

@ -0,0 +1,7 @@
#!/bin/sh
if [ -z "$REAL_EXTERNAL_IP" ]; then
export REAL_EXTERNAL_IP="$(curl -4 https://icanhazip.com 2>/dev/null)"
fi
exec echo "$REAL_EXTERNAL_IP"

View File

@ -0,0 +1,8 @@
#!/bin/sh
# If command starts with an option, prepend it with a `turnserver` binary.
if [ "${1:0:1}" == '-' ]; then
set -- turnserver "$@"
fi
exec $(eval "echo $@")

View File

@ -0,0 +1,192 @@
#
# Dockerfile of coturn/coturn:debian Docker image.
#
ARG debian_ver=buster
#
# Stage 'dist-mongoc' creates mongo-c-driver distribution.
#
# We compile mongo-c-driver from sources, because buster Debian `libmongoc` packages
# cointain too old driver version, being not compatible with latest MongoDB versions well.
#
# TODO: Reconsider this on next stable Debian version update.
# https://hub.docker.com/_/debian
FROM debian:${debian_ver}-slim AS dist-mongoc
# Install tools for building.
RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates cmake g++ gcc git make python \
&& update-ca-certificates
# Install mongo-c-driver build dependencies.
RUN apt-get install -y --no-install-recommends --no-install-suggests \
libssl-dev
# Prepare mongo-c-driver sources for building.
ARG mongoc_ver=1.17.5
RUN mkdir -p /tmp/mongoc/src/ && cd /tmp/mongoc/src/ \
&& git init \
&& git remote add origin https://github.com/mongodb/mongo-c-driver \
&& git fetch --depth=1 origin "${mongoc_ver}" \
&& git checkout FETCH_HEAD \
&& python build/calc_release_version.py > VERSION_CURRENT
# Build mongo-c-driver from sources.
RUN mkdir -p /tmp/mongoc/build/ && cd /tmp/mongoc/build/ \
&& cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF \
-DCMAKE_BUILD_TYPE=Release \
/tmp/mongoc/src
# Install mongo-c-driver.
RUN mkdir -p /out/ && cd /tmp/mongoc/build/ \
&& DESTDIR=/out cmake --build . --target install
# Preserve license file.
RUN mkdir -p /out/usr/share/licenses/mongo-c-driver/ \
&& cp /out/usr/local/share/mongo-c-driver/COPYING /out/usr/share/licenses/mongo-c-driver/ \
# Remove redundant files.
&& rm -rf /out/usr/local/bin/ \
/out/usr/local/share/
#
# Stage 'dist-coturn' creates Coturn distribution.
#
# https://hub.docker.com/_/debian
FROM debian:${debian_ver}-slim AS dist-coturn
# Install tools for building.
RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
autoconf ca-certificates coreutils g++ git libtool make pkg-config \
&& update-ca-certificates
# Install Coturn build dependencies.
RUN apt-get install -y --no-install-recommends --no-install-suggests \
libevent-dev \
libssl-dev \
libpq-dev libmariadb-dev libsqlite3-dev \
libhiredis-dev
# Install mongo-c-driver distribution.
COPY --from=dist-mongoc /out/ /
# Prepare local Coturn sources for building.
COPY CMakeLists.txt \
configure \
INSTALL \
LICENSE LICENSE.OpenSSL \
make-man.sh Makefile.in \
postinstall.txt \
README.turn* \
/app/
COPY cmake/ /app/cmake/
COPY examples/ /app/examples/
COPY man/ /app/man/
COPY src/ /app/src/
COPY turndb/ /app/turndb/
WORKDIR /app/
# Use Coturn sources from Git if `coturn_git_ref` is specified.
ARG coturn_git_ref=HEAD
RUN if [ "${coturn_git_ref}" != 'HEAD' ]; then true \
&& rm -rf /app/* \
&& git init \
&& git remote add origin https://github.com/coturn/coturn \
&& git fetch --depth=1 origin "${coturn_git_ref}" \
&& git checkout FETCH_HEAD \
&& true; fi
# Build Coturn from sources.
RUN ./configure --prefix=/usr \
--turndbdir=/var/lib/coturn \
--disable-rpath \
--sysconfdir=/etc/coturn \
# No documentation included to keep image size smaller.
--mandir=/tmp/coturn/man \
--docsdir=/tmp/coturn/docs \
--examplesdir=/tmp/coturn/examples \
&& make
# Install and configure Coturn.
RUN mkdir -p /out/ \
&& DESTDIR=/out make install \
# Remove redundant files.
&& rm -rf /out/tmp/ \
# Preserve license file.
&& mkdir -p /out/usr/share/licenses/coturn/ \
&& cp LICENSE /out/usr/share/licenses/coturn/ \
# Remove default config file.
&& rm -f /out/etc/coturn/turnserver.conf.default
# Install helper tools of Docker image.
COPY docker/coturn/debian/rootfs/ /out/
RUN chmod +x /out/usr/local/bin/docker-entrypoint.sh \
/out/usr/local/bin/detect-external-ip.sh
RUN ln -s /usr/local/bin/detect-external-ip.sh \
/out/usr/local/bin/detect-external-ip
RUN chown -R nobody:nogroup /out/var/lib/coturn/
# Re-export mongo-c-driver distribution.
COPY --from=dist-mongoc /out/ /out/
#
# Stage 'runtime' creates final Docker image to use in runtime.
#
# https://hub.docker.com/_/debian
FROM debian:${debian_ver}-slim AS runtime
LABEL org.opencontainers.image.source="https://github.com/coturn/coturn"
# Update system packages.
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates \
&& update-ca-certificates \
# Install Coturn dependencies.
&& apt-get install -y --no-install-recommends --no-install-suggests \
libevent-2.1-6 libevent-core-2.1-6 libevent-extra-2.1-6 \
libevent-openssl-2.1-6 libevent-pthreads-2.1-6 \
libssl1.1 \
libpq5 libmariadb3 libsqlite3-0 \
libhiredis0.14 \
# Cleanup unnecessary stuff.
&& rm -rf /var/lib/apt/lists/*
# Install Coturn distribution.
COPY --from=dist-coturn /out/ /
# Allow non-root using privileged ports.
RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
libcap2-bin \
&& setcap CAP_NET_BIND_SERVICE=+ep /usr/bin/turnserver \
# Cleanup unnecessary stuff.
&& apt-get purge -y --auto-remove \
-o APT::AutoRemove::RecommendsImportant=false \
libcap2-bin \
&& rm -rf /var/lib/apt/lists/*
USER nobody:nogroup
EXPOSE 3478 3478/udp
VOLUME ["/var/lib/coturn"]
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["--log-file=stdout", "--external-ip=$(detect-external-ip)"]

View File

@ -0,0 +1,7 @@
#!/bin/sh
if [ -z "$REAL_EXTERNAL_IP" ]; then
export REAL_EXTERNAL_IP="$(curl -4 https://icanhazip.com 2>/dev/null)"
fi
exec echo "$REAL_EXTERNAL_IP"

View File

@ -0,0 +1,8 @@
#!/bin/bash
# If command starts with an option, prepend it with a `turnserver` binary.
if [ "${1:0:1}" == '-' ]; then
set -- turnserver "$@"
fi
exec $(eval "echo $@")

View File

@ -0,0 +1,5 @@
{
"devDependencies": {
"bats": "^1.1"
}
}

View File

@ -0,0 +1,116 @@
#!/usr/bin/env bats
@test "Built on correct arch" {
run docker run --rm --platform $PLATFORM --entrypoint sh $IMAGE -c \
'uname -m'
[ "$status" -eq 0 ]
if [ "$PLATFORM" = "linux/amd64" ]; then
[ "$output" = "x86_64" ]
elif [ "$PLATFORM" = "linux/arm64" ]; then
[ "$output" = "aarch64" ]
elif [ "$PLATFORM" = "linux/arm/v6" ]; then
[ "$output" = "armv7l" ]
elif [ "$PLATFORM" = "linux/arm/v7" ]; then
[ "$output" = "armv7l" ]
else
[ "$output" = "$(echo $PLATFORM | cut -d '/' -f2-)" ]
fi
}
@test "Coturn is installed" {
run docker run --rm --entrypoint sh $IMAGE -c 'which turnserver'
[ "$status" -eq 0 ]
}
@test "Coturn runs ok" {
run docker run --rm --entrypoint sh $IMAGE -c 'turnserver -h'
[ "$status" -eq 0 ]
}
@test "Coturn has correct version" {
[ -z "$COTURN_VERSION" ] && skip
run docker run --rm --entrypoint sh $IMAGE -c \
"turnserver -o --log-file=stdout | grep 'Version Coturn' \
| cut -d ' ' -f2 \
| cut -d '-' -f2"
[ "$status" -eq 0 ]
[ ! "$output" = '' ]
actual="$output"
[ "$actual" = "$COTURN_VER" ]
}
@test "TLS supported" {
run docker run --rm --entrypoint sh $IMAGE -c \
"turnserver -o --log-file=stdout | grep 'TLS supported'"
[ "$status" -eq 0 ]
[ ! "$output" = '' ]
}
@test "DTLS supported" {
run docker run --rm --entrypoint sh $IMAGE -c \
"turnserver -o --log-file=stdout | grep 'DTLS supported'"
[ "$status" -eq 0 ]
[ ! "$output" = '' ]
}
@test "DTLS 1.2 supported" {
run docker run --rm --entrypoint sh $IMAGE -c \
"turnserver -o --log-file=stdout | grep 'DTLS 1.2 supported'"
[ "$status" -eq 0 ]
[ ! "$output" = '' ]
}
@test "TURN/STUN ALPN supported" {
run docker run --rm --entrypoint sh $IMAGE -c \
"turnserver -o --log-file=stdout | grep 'TURN/STUN ALPN supported'"
[ "$status" -eq 0 ]
[ ! "$output" = '' ]
}
@test "oAuth supported" {
run docker run --rm --entrypoint sh $IMAGE -c \
"turnserver -o --log-file=stdout | grep '(oAuth) supported'"
[ "$status" -eq 0 ]
[ ! "$output" = '' ]
}
@test "SQLite supported" {
run docker run --rm --entrypoint sh $IMAGE -c \
"turnserver -o --log-file=stdout | grep 'SQLite supported'"
[ "$status" -eq 0 ]
[ ! "$output" = '' ]
}
@test "Redis supported" {
run docker run --rm --entrypoint sh $IMAGE -c \
"turnserver -o --log-file=stdout | grep 'Redis supported'"
[ "$status" -eq 0 ]
[ ! "$output" = '' ]
}
@test "PostgreSQL supported" {
run docker run --rm --entrypoint sh $IMAGE -c \
"turnserver -o --log-file=stdout | grep 'PostgreSQL supported'"
[ "$status" -eq 0 ]
[ ! "$output" = '' ]
}
@test "MySQL supported" {
run docker run --rm --entrypoint sh $IMAGE -c \
"turnserver -o --log-file=stdout | grep 'MySQL supported'"
[ "$status" -eq 0 ]
[ ! "$output" = '' ]
}
@test "MongoDB supported" {
run docker run --rm --entrypoint sh $IMAGE -c \
"turnserver -o --log-file=stdout | grep 'MongoDB supported'"
[ "$status" -eq 0 ]
[ ! "$output" = '' ]
}

View File

@ -3,10 +3,11 @@ services:
# MySQL mariadb
mysql:
build:
context: ./mysql
image: mariadb
restart: unless-stopped
volumes:
- ./mysql/init-coturn-db.sql:/docker-entrypoint-initdb.d/init-coturn-db.sql:ro
- ./mysql/schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro
- mysql-data:/var/lib/mysql
env_file:
- mysql/mysql.env
@ -15,10 +16,10 @@ services:
# PostgreSQL
postgresql:
build:
context: ./postgresql
image: postgres
restart: unless-stopped
volumes:
- ./postgresql/schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro
- postgresql-data:/var/lib/postgresql
env_file:
- postgresql/postgresql.env
@ -27,10 +28,11 @@ services:
# Redis
redis:
build:
context: ./redis
image: redis
restart: unless-stopped
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
volumes:
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf:ro
- redis-data:/data
env_file:
- redis/redis.env
@ -52,12 +54,13 @@ services:
# Coturn
coturn:
build:
context: ./coturn
context: ../
dockerfile: ./docker/coturn/debian/Dockerfile
restart: always
volumes:
- ${PWD}/coturn/turnserver.conf:/etc/turnserver.conf
- ${PWD}/coturn/privkey.pem:/etc/ssl/private/privkey.pem
- ${PWD}/coturn/cert.pem:/etc/ssl/certs/cert.pem
- ./coturn/turnserver.conf:/etc/turnserver.conf:ro
- ./coturn/privkey.pem:/etc/ssl/private/privkey.pem:ro
- ./coturn/cert.pem:/etc/ssl/certs/cert.pem:ro
ports:
## STUN/TURN
- "3478:3478"

View File

@ -16,12 +16,13 @@ services:
# Coturn
coturn:
build:
context: ./coturn
context: ../
dockerfile: ./docker/coturn/debian/Dockerfile
restart: always
volumes:
- ${PWD}/coturn/turnserver.conf:/etc/turnserver.conf
- ${PWD}/coturn/privkey.pem:/etc/ssl/private/privkey.pem
- ${PWD}/coturn/cert.pem:/etc/ssl/certs/cert.pem
- ./coturn/turnserver.conf:/etc/turnserver.conf:ro
- ./coturn/privkey.pem:/etc/ssl/private/privkey.pem:ro
- ./coturn/cert.pem:/etc/ssl/certs/cert.pem:ro
ports:
## STUN/TURN
- "3478:3478"

View File

@ -3,10 +3,11 @@ services:
# MySQL mariadb
mysql:
build:
context: ./mysql
image: mariadb
restart: unless-stopped
volumes:
- ./mysql/init-coturn-db.sql:/docker-entrypoint-initdb.d/init-coturn-db.sql:ro
- ./mysql/schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro
- mysql-data:/var/lib/mysql/data
env_file:
- mysql/mysql.env
@ -17,12 +18,13 @@ services:
# Coturn
coturn:
build:
context: ./coturn
context: ../
dockerfile: ./docker/coturn/debian/Dockerfile
restart: always
volumes:
- ${PWD}/coturn/turnserver.conf:/etc/turnserver.conf
- ${PWD}/coturn/privkey.pem:/etc/ssl/private/privkey.pem
- ${PWD}/coturn/cert.pem:/etc/ssl/certs/cert.pem
- ./coturn/turnserver.conf:/etc/turnserver.conf:ro
- ./coturn/privkey.pem:/etc/ssl/private/privkey.pem:ro
- ./coturn/cert.pem:/etc/ssl/certs/cert.pem:ro
ports:
## STUN/TURN
- "3478:3478"

View File

@ -3,10 +3,10 @@ services:
# PostgreSQL
postgresql:
build:
context: ./postgresql
image: postgres
restart: unless-stopped
volumes:
- ./postgresql/schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro
- postgresql-data:/var/lib/postgresql/data
env_file:
- postgresql/postgresql.env
@ -17,12 +17,13 @@ services:
# Coturn
coturn:
build:
context: ./coturn
context: ../
dockerfile: ./docker/coturn/debian/Dockerfile
restart: always
volumes:
- ${PWD}/coturn/turnserver.conf:/etc/turnserver.conf
- ${PWD}/coturn/privkey.pem:/etc/ssl/private/privkey.pem
- ${PWD}/coturn/cert.pem:/etc/ssl/certs/cert.pem
- ./coturn/turnserver.conf:/etc/turnserver.conf:ro
- ./coturn/privkey.pem:/etc/ssl/private/privkey.pem:ro
- ./coturn/cert.pem:/etc/ssl/certs/cert.pem:ro
ports:
## STUN/TURN
- "3478:3478"

View File

@ -3,10 +3,11 @@ services:
# Redis
redis:
build:
context: ./redis
image: redis
restart: unless-stopped
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
volumes:
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf:ro
- redis-data:/data
env_file:
- redis/redis.env
@ -17,12 +18,13 @@ services:
# Coturn
coturn:
build:
context: ./coturn
context: ../
dockerfile: ./docker/coturn/debian/Dockerfile
restart: always
volumes:
- ${PWD}/coturn/turnserver.conf:/etc/turnserver.conf
- ${PWD}/coturn/privkey.pem:/etc/ssl/private/privkey.pem
- ${PWD}/coturn/cert.pem:/etc/ssl/certs/cert.pem
- ./coturn/turnserver.conf:/etc/turnserver.conf:ro
- ./coturn/privkey.pem:/etc/ssl/private/privkey.pem:ro
- ./coturn/cert.pem:/etc/ssl/certs/cert.pem:ro
ports:
## STUN/TURN
- "3478:3478"

View File

@ -1,6 +0,0 @@
### init db with coturn schema
FROM mariadb
ADD init-coturn-db.sql /docker-entrypoint-initdb.d
ADD schema.sql /docker-entrypoint-initdb.d

View File

@ -1,4 +0,0 @@
### init db with coturn schema
FROM postgres
ADD schema.sql /docker-entrypoint-initdb.d

View File

@ -1,6 +0,0 @@
### init db with coturn schema
FROM redis
COPY redis.conf /usr/local/etc/redis/redis.conf
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]