Skip to content

Commit

Permalink
Reduce Docker image size
Browse files Browse the repository at this point in the history
- Removed useless apt cache from layer 3
- Avoid installing apt recommended packages

The compressed image now weights 67 MB less (≈ -30% size).

Signed-off-by: JoeLametta <[email protected]>
  • Loading branch information
JoeLametta committed Nov 27, 2019
1 parent d0efd74 commit bbd28c6
Showing 1 changed file with 47 additions and 26 deletions.
73 changes: 47 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,52 +1,73 @@
FROM debian:buster

RUN apt-get update \
&& apt-get install -y autoconf cdrdao curl eject flac gir1.2-glib-2.0 git libiso9660-dev \
libsndfile1-dev libtool locales make pkgconf python3-gi \
python3-musicbrainzngs python3-mutagen python3-pip python3-requests \
python3-ruamel.yaml python3-setuptools sox swig \
&& pip3 install pycdio==2.1.0
RUN apt-get update && apt-get install --no-install-recommends -y \
autoconf \
automake \
cdrdao \
bzip2 \
curl \
eject \
flac \
gir1.2-glib-2.0 \
git \
libiso9660-dev \
libsndfile1-dev \
libtool \
locales \
make \
pkgconf \
python3-dev \
python3-gi \
python3-musicbrainzngs \
python3-mutagen \
python3-pip \
python3-requests \
python3-ruamel.yaml \
python3-setuptools \
sox \
swig \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& pip3 --no-cache-dir install pycdio==2.1.0

# libcdio-paranoia / libcdio-utils are wrongfully packaged in Debian, thus built manually
# see https://github.com/whipper-team/whipper/pull/237#issuecomment-367985625
RUN curl -o - 'https://ftp.gnu.org/gnu/libcdio/libcdio-2.1.0.tar.bz2' | tar jxf - \
&& cd libcdio-2.1.0 \
&& autoreconf -fi \
&& ./configure --disable-dependency-tracking --disable-cxx --disable-example-progs --disable-static \
&& make install \
&& cd .. \
&& rm -rf libcdio-2.1.0
&& cd libcdio-2.1.0 \
&& autoreconf -fi \
&& ./configure --disable-dependency-tracking --disable-cxx --disable-example-progs --disable-static \
&& make install \
&& cd .. \
&& rm -rf libcdio-2.1.0

# Install cd-paranoia from tarball
RUN curl -o - 'https://ftp.gnu.org/gnu/libcdio/libcdio-paranoia-10.2+2.0.0.tar.bz2' | tar jxf - \
&& cd libcdio-paranoia-10.2+2.0.0 \
&& autoreconf -fi \
&& ./configure --disable-dependency-tracking --disable-example-progs --disable-static \
&& make install \
&& cd .. \
&& rm -rf libcdio-paranoia-10.2+2.0.0
&& cd libcdio-paranoia-10.2+2.0.0 \
&& autoreconf -fi \
&& ./configure --disable-dependency-tracking --disable-example-progs --disable-static \
&& make install \
&& cd .. \
&& rm -rf libcdio-paranoia-10.2+2.0.0

RUN ldconfig

# add user
RUN useradd -m worker -G cdrom \
&& mkdir -p /output /home/worker/.config/whipper \
&& chown worker: /output /home/worker/.config/whipper
&& mkdir -p /output /home/worker/.config/whipper \
&& chown worker: /output /home/worker/.config/whipper
VOLUME ["/home/worker/.config/whipper", "/output"]

# setup locales + cleanup
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment \
&& echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& echo "LANG=en_US.UTF-8" > /etc/locale.conf \
&& locale-gen en_US.UTF-8 \
&& apt-get clean && apt-get autoremove -y
&& echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& echo "LANG=en_US.UTF-8" > /etc/locale.conf \
&& locale-gen en_US.UTF-8

# install whipper
RUN mkdir /whipper
COPY . /whipper/
RUN cd /whipper && python3 setup.py install \
&& rm -rf /whipper \
&& whipper -v
&& rm -rf /whipper \
&& whipper -v

ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US
Expand Down

0 comments on commit bbd28c6

Please sign in to comment.