-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
107 lines (83 loc) · 2.97 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
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
103
104
105
106
107
# Use Alpine as a build environment
FROM alpine:latest as build
# Update package repository and install necessary dependencies
RUN apk update && \
apk upgrade && \
apk add --no-cache \
git \
linux-headers \
alpine-sdk \
cmake \
tcl \
openssl-dev \
zlib-dev
# Set the working directory to /tmp
WORKDIR /tmp
# Clone the required repositories
RUN git clone --depth 1 https://github.com/alexandre-leites/srtla.git && \
git clone --depth 1 https://github.com/alexandre-leites/srt.git && \
git clone --depth 1 https://github.com/alexandre-leites/srt-live-server.git
# Switch to the srt repository directory
WORKDIR /tmp/srt
# Checkout the master branch and build and install srt library
RUN git checkout master && \
./configure && \
make -j8 && \
make install
# Switch to the srtla repository directory
WORKDIR /tmp/srtla
# Checkout the master branch and build srtla library
RUN git checkout main && \
make -j8 srtla_rec
# Switch to the sls repository directory
WORKDIR /tmp/srt-live-server
# Checkout the master branch and build sls library
RUN git checkout master && \
make -j8
# Use Alpine Linux as the final base image
FROM alpine:latest
# Set environment variables
ENV LD_LIBRARY_PATH /lib:/usr/lib:/usr/local/lib64
# Update package repository and install necessary dependencies
RUN apk update && \
apk upgrade && \
apk add --no-cache \
supervisor \
openssl \
bash \
libstdc++
# Add a user for running the application
RUN mkdir /etc/sls /logs
# Copy necessary files and directories from the build stage
COPY --from=build /usr/local/bin/srt-* /usr/local/bin/
COPY --from=build /usr/local/lib/libsrt* /usr/local/lib/
COPY --from=build /tmp/srt-live-server/bin/* /usr/local/bin/
COPY --from=build /tmp/srt/srt-live-transmit /usr/local/bin/srt-live-transmit
COPY --from=build /tmp/srt/srt-tunnel /usr/local/bin/srt-tunnel
COPY --from=build /tmp/srtla/srtla_rec /usr/local/bin/srtla_rec
# Copy the sls.conf file to /etc/sls directory
COPY --from=build /tmp/srt-live-server/sls.conf /etc/sls/
# Create a volume for logs
VOLUME /logs
# Environment Variables
ENV SRTLA_PORT 5000
ENV SLS_HTTP_PORT 8181
ENV SLS_SRT_PORT 30000
ENV SLS_DEFAULT_SID live/feed1
ENV SLS_SRT_LATENCY 1000
ENV SLS_SRT_TIMEOUT -1
ENV SLS_SRT_LATENCY 1000
ENV SLT_SRT_LOSSMAXTTL 40
# Expose ports
EXPOSE $SLS_HTTP_PORT/tcp $SRTLA_PORT/udp $SLS_SRT_PORT/udp
# Set working dir to /opt
WORKDIR /opt
# Copy necessary configurations and scripts
COPY files/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY files/supervisord.conf /etc/supervisor/supervisord.conf
COPY files/logprefix /usr/local/bin/logprefix
COPY files/restart_all_on_exit /usr/local/bin/restart_all_on_exit
# Ensure the scripts are executable
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/logprefix /usr/local/bin/restart_all_on_exit
# Set the entrypoint to entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]