File size: 2,185 Bytes
43c4269
cf148b3
7bacb80
0140a0b
92a3558
0140a0b
4e19f8b
 
 
 
 
 
75a759d
5fb595d
5c1b9aa
 
 
 
 
 
 
 
ca36264
7b5ccf8
 
30f8168
ca36264
 
 
 
 
30f8168
75a759d
30f8168
 
721fd7b
30f8168
 
cf148b3
 
 
 
 
30f8168
 
721fd7b
30f8168
 
bb69236
 
ab1c911
30f8168
bb69236
ab1c911
28c7c7e
 
30f8168
c395084
30f8168
 
3776b26
 
b0d7950
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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"]