Spaces:
Paused
Paused
| FROM ubuntu:22.04 | |
| # Build args (change if upstream playit repo changes) | |
| ARG PLAYIT_GPG_URL="https://playit-cloud.github.io/ppa/key.gpg" | |
| ARG PLAYIT_APT_LINE="deb [signed-by=/etc/apt/trusted.gpg.d/playit.gpg] https://playit-cloud.github.io/ppa/data ./" | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| TZ=Etc/UTC \ | |
| LANG=C.UTF-8 | |
| USER root | |
| # Install dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| libpcre3 libpcre3-dev \ | |
| libssl-dev \ | |
| zlib1g-dev \ | |
| wget \ | |
| nginx \ | |
| ffmpeg \ | |
| git \ | |
| build-essential \ | |
| libpcre3 libpcre3-dev \ | |
| libssl-dev \ | |
| wget \ | |
| curl \ | |
| unzip \ | |
| openssl \ | |
| apt-transport-https \ | |
| ca-certificates \ | |
| gnupg \ | |
| dirmngr \ | |
| tzdata \ | |
| gettext-base \ | |
| ; \ | |
| # ensure tzdata doesn't prompt (already set TZ env); configure timezone non-interactively | |
| ln -fs /usr/share/zoneinfo/$TZ /etc/localtime; \ | |
| dpkg-reconfigure --frontend noninteractive tzdata || true; \ | |
| # prepare apt trusted key location | |
| mkdir -p /etc/apt/trusted.gpg.d; \ | |
| # fetch playit GPG key and dearmor it for apt | |
| curl -fsSL "${PLAYIT_GPG_URL}" -o /tmp/playit.key.gpg; \ | |
| gpg --dearmor --batch --yes -o /etc/apt/trusted.gpg.d/playit.gpg /tmp/playit.key.gpg; \ | |
| rm -f /tmp/playit.key.gpg; \ | |
| # add apt source list | |
| echo "${PLAYIT_APT_LINE}" > /etc/apt/sources.list.d/playit-cloud.list; \ | |
| apt-get update; \ | |
| # Install playit, telling dpkg to accept default config answers if asked | |
| apt-get install -y --no-install-recommends -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" playit; \ | |
| # cleanup apt caches | |
| apt-get clean; \ | |
| rm -rf /var/lib/apt/lists/* /tmp/* | |
| # Install Nginx with RTMP module | |
| RUN mkdir -p /opt/nginx && \ | |
| cd /opt/nginx && \ | |
| git clone https://github.com/arut/nginx-rtmp-module.git && \ | |
| wget http://nginx.org/download/nginx-1.25.0.tar.gz && \ | |
| tar -zxvf nginx-1.25.0.tar.gz && \ | |
| cd nginx-1.25.0 && \ | |
| ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module && \ | |
| make && make install | |
| RUN mkdir -p /tmp/nginx /tmp/nginx/logs /tmp/nginx/proxy_temp /tmp/nginx/html /tmp/nginx/html/media/hls /tmp/nginx/html/media/rhls /tmp/nginx/html/media/recordings \ | |
| && chmod -R 777 /tmp/nginx /tmp/nginx/html /usr/local/nginx/sbin/nginx | |
| RUN chmod -R 755 /tmp/nginx/html/media | |
| # Copy configs and web UI | |
| COPY nginx.conf /tmp/nginx/nginx.conf | |
| COPY www/ /tmp/nginx/html/ | |
| COPY mime.types /tmp/nginx/mime.types | |
| # Copy entrypoint | |
| COPY init.sh /tmp/nginx/entrypoint.sh | |
| RUN chmod +x /tmp/nginx/entrypoint.sh | |
| RUN chmod +x /tmp/nginx/logs | |
| # Expose only HF Spaces allowed port | |
| EXPOSE 7860/tcp | |
| # Workdir | |
| WORKDIR /tmp/app | |
| USER root | |
| ENTRYPOINT ["/tmp/nginx/entrypoint.sh"] | |
| CMD [] |