Refactor dockerfile to reduce build time
This commit is contained in:
parent
a5bc892ba5
commit
5d2ae15edc
1 changed files with 52 additions and 57 deletions
109
Dockerfile
109
Dockerfile
|
@ -1,3 +1,43 @@
|
||||||
|
FROM debian:buster AS builder
|
||||||
|
|
||||||
|
# Build-time dependencies
|
||||||
|
RUN apt-get update -yqq && apt-get install -yqq \
|
||||||
|
ca-certificates \
|
||||||
|
build-essential \
|
||||||
|
pkg-config \
|
||||||
|
qt5-default \
|
||||||
|
libqt5svg5* \
|
||||||
|
libboost-dev \
|
||||||
|
libasound2-dev \
|
||||||
|
libssl-dev \
|
||||||
|
libspeechd-dev \
|
||||||
|
libzeroc-ice-dev \
|
||||||
|
libpulse-dev \
|
||||||
|
libcap-dev \
|
||||||
|
libprotobuf-dev \
|
||||||
|
libprotoc-dev \
|
||||||
|
protobuf-compiler \
|
||||||
|
protobuf-compiler-grpc \
|
||||||
|
libgrpc++-dev \
|
||||||
|
libogg-dev \
|
||||||
|
libavahi-compat-libdnssd-dev \
|
||||||
|
libsndfile1-dev \
|
||||||
|
libbz2-dev \
|
||||||
|
libxi-dev \
|
||||||
|
git --no-install-recommends
|
||||||
|
|
||||||
|
WORKDIR /usr/src/murmur
|
||||||
|
RUN \
|
||||||
|
git clone https://github.com/mumble-voip/mumble.git . \
|
||||||
|
&& git checkout master \
|
||||||
|
&& git submodule init \
|
||||||
|
&& git submodule update
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
qmake -recursive main.pro CONFIG+="no-client no-g15 no-bonjour grpc" \
|
||||||
|
&& make release
|
||||||
|
|
||||||
|
|
||||||
FROM debian:buster
|
FROM debian:buster
|
||||||
EXPOSE 64738/tcp 64738/udp
|
EXPOSE 64738/tcp 64738/udp
|
||||||
|
|
||||||
|
@ -5,71 +45,26 @@ ENV HOME /home/user
|
||||||
RUN useradd --create-home --home-dir $HOME user \
|
RUN useradd --create-home --home-dir $HOME user \
|
||||||
&& chown -R user:user $HOME
|
&& chown -R user:user $HOME
|
||||||
|
|
||||||
# Runtime dependencies for murmurd
|
WORKDIR $HOME
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
ca-certificates \
|
# Runtime dependencies
|
||||||
libprotobuf17 \
|
RUN apt-get update && apt-get install -yqq \
|
||||||
|
ca-certificates \
|
||||||
|
'libprotobuf[0-9]+$' \
|
||||||
|
libqt5core5a \
|
||||||
|
libqt5dbus5 \
|
||||||
libqt5xml5 \
|
libqt5xml5 \
|
||||||
libqt5sql5 \
|
libqt5sql5 \
|
||||||
libqt5network5 \
|
libqt5network5 \
|
||||||
libcap2 \
|
libcap2 \
|
||||||
libgrpc6 \
|
'libgrpc[0-9]+$' \
|
||||||
libgrpc++1 \
|
libgrpc++1 \
|
||||||
libzeroc-ice3.7 \
|
libzeroc-ice3.7 \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# The build dependencies will be uninstalled after compilation,
|
COPY --from=builder /usr/src/murmur/release/murmurd /usr/bin/murmurd
|
||||||
# so the image doesn't get bloated.
|
|
||||||
RUN buildDeps=' \
|
|
||||||
build-essential \
|
|
||||||
pkg-config \
|
|
||||||
qt5-default \
|
|
||||||
qtbase5-dev \
|
|
||||||
qttools5-dev \
|
|
||||||
qttools5-dev-tools \
|
|
||||||
libqt5svg5* \
|
|
||||||
libspeex1 \
|
|
||||||
libspeex-dev \
|
|
||||||
libboost-dev \
|
|
||||||
libasound2-dev \
|
|
||||||
libssl-dev \
|
|
||||||
g++ \
|
|
||||||
libspeechd-dev \
|
|
||||||
libzeroc-ice-dev \
|
|
||||||
zeroc-ice-slice \
|
|
||||||
libpulse-dev \
|
|
||||||
libcap-dev \
|
|
||||||
libspeexdsp-dev \
|
|
||||||
libprotobuf-dev \
|
|
||||||
libprotoc-dev \
|
|
||||||
protobuf-compiler \
|
|
||||||
protobuf-compiler-grpc \
|
|
||||||
libgrpc-dev \
|
|
||||||
libgrpc++-dev \
|
|
||||||
libogg-dev \
|
|
||||||
libavahi-compat-libdnssd-dev \
|
|
||||||
libsndfile1-dev \
|
|
||||||
libxi-dev \
|
|
||||||
git \
|
|
||||||
' \
|
|
||||||
&& set -x \
|
|
||||||
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& mkdir -p /usr/src/murmur \
|
|
||||||
&& git clone https://github.com/mumble-voip/mumble.git /usr/src/murmur \
|
|
||||||
&& cd /usr/src/murmur \
|
|
||||||
&& git checkout 7c67ea33f47716a188da045ead2035f978fc6253 \
|
|
||||||
&& git submodule init \
|
|
||||||
&& git submodule update \
|
|
||||||
&& qmake -recursive main.pro CONFIG+="no-client no-g15 no-bonjour grpc" \
|
|
||||||
&& make \
|
|
||||||
&& cp -r release/ /home/user/release \
|
|
||||||
&& chmod a+r /home/user/release -R \
|
|
||||||
&& rm -rf /usr/src/murmur \
|
|
||||||
&& apt-get purge -y --auto-remove $buildDeps
|
|
||||||
|
|
||||||
WORKDIR $HOME
|
|
||||||
USER user
|
USER user
|
||||||
|
|
||||||
ENTRYPOINT [ "/home/user/release/murmurd" ]
|
ENTRYPOINT [ "/usr/bin/murmurd" ]
|
||||||
CMD [ "-fg", "-v", "-ini", "/data/murmur.ini" ]
|
CMD [ "-fg", "-v", "-ini", "/data/murmur.ini" ]
|
||||||
|
|
Loading…
Reference in a new issue