-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
75 lines (62 loc) · 2.13 KB
/
Dockerfile
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
ARG NGINX_VERSION=1.26.2
ARG NGINX_HTTP_FLV_MODULE=1.2.11
ARG HTTP_PORT=80
ARG HTTPS_PORT=443
ARG RTMP_PORT=1935
ARG HTTP_FLV_MODULE=9000
###################################################
# Build this NGINX-build image.
FROM alpine:latest as build-nginx
ARG NGINX_VERSION
ARG NGINX_HTTP_FLV_MODULE
WORKDIR /workspace
# Get nginx and Get nginx-http-flv-module
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories\
&& apk update \
&& apk add --no-cache g++ pcre-dev zlib-dev make openssl openssl-dev\
&& wget https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz\
&& tar -zxvf nginx-${NGINX_VERSION}.tar.gz\
&& rm nginx-${NGINX_VERSION}.tar.gz\
&& wget https://github.com/winshining/nginx-http-flv-module/archive/refs/tags/v${NGINX_HTTP_FLV_MODULE}.tar.gz\
&& tar -zxvf v${NGINX_HTTP_FLV_MODULE}.tar.gz\
&& rm v${NGINX_HTTP_FLV_MODULE}.tar.gz
WORKDIR /workspace/nginx-${NGINX_VERSION}
RUN \
./configure \
--prefix=/usr/local/nginx \
--add-module=/workspace/nginx-http-flv-module-${NGINX_HTTP_FLV_MODULE} \
--conf-path=/etc/nginx/nginx.conf \
--with-threads \
--with-http_ssl_module \
--with-debug \
--with-http_stub_status_module \
--with-cc-opt="-Wimplicit-fallthrough=0" && \
make && \
make install
#######################################
# Build the release image.
FROM alpine:latest
ARG HTTP_PORT
ARG HTTPS_PORT
ARG RTMP_PORT
ARG HTTP_FLV_MODULE
ENV HTTP_PORT ${HTTP_PORT}
ENV HTTPS_PORT ${HTTPS_PORT}
ENV RTMP_PORT ${RTMP_PORT}
ENV HTTP_FLV_MODULE ${HTTP_FLV_MODULE}
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories\
&& apk update \
&& apk add --no-cache pcre-dev zlib-dev openssl openssl-dev gettext ffmpeg
COPY --from=build-nginx /usr/local/nginx /usr/local/nginx
COPY --from=build-nginx /etc/nginx /etc/nginx
# Add NGINX path, config and static files.
ENV PATH "${PATH}:/usr/local/nginx/sbin"
RUN mkdir -p /opt/data && mkdir /www && mkdir -p /usr/local/nginx/rtmp
COPY nginx.conf /etc/nginx/nginx.conf
COPY stat.xsl /usr/local/nginx/rtmp/stat.xsl
# COPY static /www/static
EXPOSE 80
EXPOSE 443
EXPOSE 1935
EXPOSE 9000
CMD ["nginx", "-g", "daemon off;"]