FROM coturn/coturn:edge-debian USER root # Install dependencies: coturn, openssl, curl (for ngrok install), bash, socat # RUN apk add --no-cache coturn openssl curl bash # # Download and install ngrok (latest Linux amd64) # RUN curl -s https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-v3-stable-linux-amd64.zip -o /tmp/ngrok.zip \ # && unzip /tmp/ngrok.zip -d /usr/local/bin \ # && rm /tmp/ngrok.zip \ # && chmod +x /usr/local/bin/ngrok RUN apt update \ && apt-get install -y openssl curl bash python3 RUN curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc \ | tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null \ && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" \ | tee /etc/apt/sources.list.d/ngrok.list \ && apt-get update \ && apt-get install -y ngrok \ && rm -rf /var/lib/apt/lists/* RUN mkdir -p /home/user # All users can use /home/user as their home directory ENV HOME=/home/user RUN mkdir $HOME/.cache $HOME/.config \ && chmod -R 777 $HOME # Install socat and openssl for certificate generation # RUN apk add --no-cache socat openssl # Create cert directory # RUN mkdir -p /etc/turn/certs # Generate self-signed cert and private key (valid 365 days) # RUN openssl req -x509 -nodes -newkey rsa:2048 \ # -keyout /etc/turn/certs/turn_server_pkey.pem \ # -out /etc/turn/certs/turn_server_cert.pem \ # -days 365 \ # -subj "/C=US/ST=State/L=City/O=Org/OU=Unit/CN=privateone-cotun.hf.space" # Set cert directory permissions # RUN chmod 600 /etc/turn/certs/* # Copy your custom entrypoint script RUN mkdir -p /custom-entrypoint /ngrok2 COPY ngrok.yml /ngrok2/ngrok.yml COPY custom-entrypoint.sh /custom-entrypoint/entrypoint.sh RUN chmod +x /custom-entrypoint/entrypoint.sh /ngrok2/ngrok.yml COPY turnserver.conf /etc/coturn/turnserver.conf RUN chmod +x /etc/coturn/turnserver.conf # Expose port 7860 TCP and UDP EXPOSE 7860 5349 50000-50010/udp # Set custom entrypoint ENTRYPOINT ["/custom-entrypoint/entrypoint.sh"] #CMD ["turnserver" "-c" "/etc/coturn/turnserver.conf" "--no-cli"] # CMD ["ngrok", "start", "turn_tls", "--config", "/ngrok2/ngrok.yml", "--log=stdout", "--log-level=debug"]