Skip to content

Commit

Permalink
Simplify and minimize Dockerfile
Browse files Browse the repository at this point in the history
Update to debian bookworm.

Size reduced from 448M to 300M.
  • Loading branch information
orgads committed Jun 22, 2023
1 parent 85fd27f commit af0fa90
Showing 1 changed file with 56 additions and 26 deletions.
82 changes: 56 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,64 @@
FROM debian:stretch
FROM debian:bookworm-slim AS build

RUN apt-get update \
&& apt-get -y --quiet --force-yes upgrade curl iproute2 \
&& apt-get install -y --no-install-recommends ca-certificates gcc g++ make build-essential git iptables-dev libavfilter-dev \
libevent-dev libpcap-dev libxmlrpc-core-c3-dev markdown \
libjson-glib-dev default-libmysqlclient-dev libhiredis-dev libssl-dev \
libcurl4-openssl-dev libavcodec-extra gperf libspandsp-dev libwebsockets-dev\
&& cd /usr/local/src \
&& git clone https://github.com/sipwise/rtpengine.git \
&& cd rtpengine/daemon \
&& make && make install \
&& cp /usr/local/src/rtpengine/daemon/rtpengine /usr/local/bin/rtpengine \
&& rm -Rf /usr/local/src/rtpengine \
&& apt-get purge -y --quiet --force-yes --auto-remove \
ca-certificates gcc g++ make build-essential git markdown \
&& rm -rf /var/lib/apt/* \
&& rm -rf /var/lib/dpkg/* \
&& rm -rf /var/lib/cache/* \
&& rm -Rf /var/log/* \
&& rm -Rf /usr/local/src/* \
&& rm -Rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
default-libmysqlclient-dev \
g++ \
gcc \
git \
gperf \
libavcodec-extra \
libavfilter-dev \
libcurl4-openssl-dev \
libevent-dev \
libhiredis-dev \
libiptc-dev \
libjson-glib-dev \
libopus-dev \
libpcap-dev \
libpcre3-dev \
libspandsp-dev \
libssl-dev \
libwebsockets-dev \
libxmlrpc-core-c3-dev \
make \
markdown \
pandoc

WORKDIR /usr/src
RUN git clone https://github.com/sipwise/rtpengine
WORKDIR /usr/src/rtpengine/daemon
RUN make -j$(nproc) install

FROM debian:bookworm-slim

VOLUME ["/tmp"]
ENTRYPOINT ["/entrypoint.sh"]
CMD ["rtpengine"]

EXPOSE 23000-32768/udp 22222/udp

COPY ./entrypoint.sh /entrypoint.sh
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
iproute2 \
libavcodec59 \
libavformat59 \
libevent-2.1-7 \
libevent-pthreads-2.1-7 \
libglib2.0-0 \
libhiredis0.14 \
libip4tc2 \
libip6tc2 \
libjson-glib-1.0-0 \
libmariadb3 \
libpcap0.8 \
libpcre3 \
libspandsp2 \
libwebsockets17 \
libxmlrpc-core-c3 \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*.deb

COPY --from=build /usr/src/rtpengine/daemon/rtpengine /usr/local/bin/rtpengine
COPY ./entrypoint.sh /entrypoint.sh
COPY ./rtpengine.conf /etc

ENTRYPOINT ["/entrypoint.sh"]

CMD ["rtpengine"]

0 comments on commit af0fa90

Please sign in to comment.