-
Notifications
You must be signed in to change notification settings - Fork 972
/
Dockerfile.live
102 lines (86 loc) · 2.93 KB
/
Dockerfile.live
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
FROM ubuntu:latest
ARG DEBIAN_FRONTEND=noninteractive
ARG NGINX_RTMP_PORT
ARG NGINX_HTTP_PORT
ARG NGINX_HTTPS_PORT
ARG SERVER_NAME
ARG CREATE_TLS_CERTIFICATE
ARG TLS_CERTIFICATE_FILE
ARG TLS_CERTIFICATE_KEY
# Update and upgrade packages
RUN apt-get update -y && apt-get upgrade -y
# Install basic packages
RUN apt-get install -y --no-install-recommends \
dos2unix \
bash-completion \
lsof \
rsyslog \
cron \
rsync \
ca-certificates \
apt-transport-https \
software-properties-common \
curl \
build-essential \
libssl-dev \
ffmpeg \
zlib1g-dev \
wget
# Install PHP packages
RUN apt-get install -y --no-install-recommends \
php-fpm \
php-cli \
php-curl
# Install NGINX dependencies
RUN apt-get install -y --no-install-recommends \
libpcre3 \
libpcre3-dev
# Install Git and Certbot
RUN apt-get install -y --no-install-recommends \
git \
python3-certbot-nginx
# Build NGINX with RTMP module
RUN mkdir ~/build && \
cd ~/build && \
git clone https://github.com/arut/nginx-rtmp-module.git && \
git clone https://github.com/nginx/nginx.git && \
cd nginx && \
./auto/configure --with-http_ssl_module --with-http_stub_status_module --with-http_auth_request_module --add-module=../nginx-rtmp-module --with-cc-opt="-Wimplicit-fallthrough=0" && \
make && \
make install
# Download and configure NGINX
RUN cd /usr/local/nginx/html && \
wget https://youphp.tube/docs/stat.xsl --no-check-certificate && \
mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.old && \
cd /usr/local/nginx/conf/ && \
wget https://raw.githubusercontent.com/WWBN/AVideo/master/plugin/Live/install/nginx.conf --no-check-certificate && \
mkdir /HLS && \
mkdir /HLS/live && \
mkdir /HLS/low && \
mkdir /var/www/tmp/ && \
chmod 777 /var/www/tmp
# Copy configuration files
COPY deploy/nginx/docker-entrypoint-live /usr/local/bin/docker-entrypoint-live
COPY deploy/nginx/nginx.conf /usr/local/nginx/conf/nginx.conf
COPY deploy/nginx/crontab /etc/cron.d/crontab
# Set permissions for crontab
RUN dos2unix /etc/cron.d/crontab && \
chmod 0644 /etc/cron.d/crontab && \
chmod +x /etc/cron.d/crontab && \
service cron start && \
crontab /etc/cron.d/crontab
# Set permissions for docker-entrypoint-live
RUN dos2unix /usr/local/bin/docker-entrypoint-live && \
chmod 755 /usr/local/bin/docker-entrypoint-live && \
chmod +x /usr/local/bin/docker-entrypoint-live
# Create directory and set permissions
VOLUME /var/www/tmp
RUN mkdir -p /var/www/tmp && \
chmod 777 /var/www/tmp
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Expose ports
EXPOSE $NGINX_RTMP_PORT
EXPOSE $NGINX_HTTP_PORT
EXPOSE $NGINX_HTTPS_PORT
# Set the entrypoint and command
ENTRYPOINT ["/usr/local/bin/docker-entrypoint-live"]