Update Dockerfile

Hi, this is Mizzlr. I have updated your docker file, to make it cleaner and build to a smaller image size. The modified docker file builds to an image of size 537 MB, while the original docker file resulted in an image of size 640 MB. I have built and tested the modified docker file, and works awesome. Please accept my proposal for docker file change.
This commit is contained in:
Mushtaque Ahamed A 2016-09-23 17:10:04 +04:00 committed by GitHub
parent 17f27360fe
commit 13662fb2d1

View File

@ -7,33 +7,44 @@ EXPOSE 1935
EXPOSE 80 EXPOSE 80
# create directories # create directories
RUN mkdir /src && mkdir /config && mkdir /logs && mkdir /data && mkdir /static RUN mkdir /src /config /logs /data /static
# update and upgrade packages # update and upgrade packages
RUN apt-get update && apt-get upgrade -y && apt-get clean RUN apt-get update && \
RUN apt-get install -y build-essential wget apt-get upgrade -y && \
apt-get clean && \
apt-get install -y --no-install-recommends build-essential \
wget software-properties-common && \
# ffmpeg # ffmpeg
RUN apt-get install -y software-properties-common add-apt-repository ppa:mc3man/trusty-media && \
RUN add-apt-repository ppa:mc3man/trusty-media apt-get update && \
RUN apt-get update apt-get install -y --no-install-recommends ffmpeg && \
RUN apt-get install -y ffmpeg
# nginx dependencies # nginx dependencies
RUN apt-get install -y libpcre3-dev zlib1g-dev libssl-dev apt-get install -y --no-install-recommends libpcre3-dev \
RUN apt-get install -y wget zlib1g-dev libssl-dev wget && \
rm -rf /var/lib/apt/lists/*
# get nginx source # get nginx source
RUN cd /src && wget http://nginx.org/download/nginx-1.6.2.tar.gz && tar zxf nginx-1.6.2.tar.gz && rm nginx-1.6.2.tar.gz WORKDIR /src
RUN wget http://nginx.org/download/nginx-1.6.2.tar.gz && \
tar zxf nginx-1.6.2.tar.gz && \
rm nginx-1.6.2.tar.gz && \
# get nginx-rtmp module # get nginx-rtmp module
RUN cd /src && wget https://github.com/arut/nginx-rtmp-module/archive/v1.1.6.tar.gz && tar zxf v1.1.6.tar.gz && rm v1.1.6.tar.gz wget https://github.com/arut/nginx-rtmp-module/archive/v1.1.6.tar.gz && \
tar zxf v1.1.6.tar.gz && \
rm v1.1.6.tar.gz
# compile nginx # compile nginx
RUN cd /src/nginx-1.6.2 && ./configure --add-module=/src/nginx-rtmp-module-1.1.6 --conf-path=/config/nginx.conf --error-log-path=/logs/error.log --http-log-path=/logs/access.log WORKDIR /src/nginx-1.6.2
RUN cd /src/nginx-1.6.2 && make && make install RUN ./configure --add-module=/src/nginx-rtmp-module-1.1.6 \
--conf-path=/config/nginx.conf \
--error-log-path=/logs/error.log \
--http-log-path=/logs/access.log && \
make && \
make install
ADD nginx.conf /config/nginx.conf ADD nginx.conf /config/nginx.conf
ADD static /static ADD static /static
WORKDIR /
CMD "nginx" CMD "nginx"