diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..ca7121f --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,38 @@ +FROM rust:1.48-alpine AS build + +ARG REV=master + +RUN apk add --no-cache \ + clang-libs \ + curl \ + libc-dev \ + libnice-dev \ + openssl-dev \ + ; +WORKDIR /src +RUN curl https://codeload.github.com/Johni0702/mumble-web-proxy/tar.gz/$REV \ + | tar -xzf - --strip-components 1 +RUN echo -e '\n[dependencies."async-trait"]\ndefault-features = false' >> Cargo.toml +RUN RUSTFLAGS="-C target-feature=-crt-static" cargo install --path . + +FROM alpine + +RUN apk add --no-cache \ + bash \ + libgcc \ + libnice \ + ; +COPY --from=build /usr/local/cargo/bin/mumble-web-proxy /mumble-web-proxy +COPY entrypoint.sh /entrypoint.sh + +ENV MWP_LISTEN_WS=64737 +ENV MWP_SERVER=mumble-server:64738 +ENV MWP_ACCEPT_INVALID_CERTIFICATE= +ENV MWP_ICE_PORT_MIN= +ENV MWP_ICE_PORT_MAX= +ENV MWP_ICE_IPV4= +ENV MWP_ICE_IPV6= + +CMD ["/entrypoint.sh"] +USER 1000 +EXPOSE 64737 diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..ee3f840 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,13 @@ +# mumble-web-proxy OCI image + +This directory provides files to build a mumble-web-proxy OCI image. +The image is based on Alpine Linux and is less than 30 MiB in size. +One can use [Docker](https://www.docker.com/) in order to build the image, +as follows. + +``` +docker build --build-arg REV=master -t mumble-web-proxy . +``` + +`master` can be replaced by any revision (i.e. branch, tag or commit hash) of +this repository. diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..17c440f --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +cmd=("/mumble-web-proxy" "--listen-ws=$MWP_LISTEN_WS" "--server=$MWP_SERVER") + +if [ "$MWP_ACCEPT_INVALID_CERTIFICATE" = true ]; then + cmd+=("--accept-invalid-certificate") +fi + +if [ -n "$MWP_ICE_PORT_MIN" ]; then + cmd+=("--ice-port-min=$MWP_ICE_PORT_MIN") +fi + +if [ -n "$MWP_ICE_PORT_MAX" ]; then + cmd+=("--ice-port-max=$MWP_ICE_PORT_MAX") +fi + +if [ -n "$MWP_ICE_IPV4" ]; then + cmd+=("--ice-ipv4=$MWP_ICE_IPV4") +fi + +if [ -n "$MWP_ICE_IPV6" ]; then + cmd+=("--ice-ipv6=$MWP_ICE_IPV6") +fi + +exec "${cmd[@]}"