Skip to content

Commit

Permalink
make Docker image smaller + use debian:buster-slim base
Browse files Browse the repository at this point in the history
This commit updates the Dockerfile to use multiple stages. In the first stage, compile-time dependencies are installed, and libzmq is compiled and tested. The second stage starts with a fresh, slim Docker image, and the compiled outputs of the first stage are copied over. Runtime dependencies, like libsodium and kerberos, are installed as well.
  • Loading branch information
kaczmarj committed Jul 29, 2020
1 parent 7deb8de commit ddbef32
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
FROM ubuntu:14.04
FROM debian:buster-slim AS builder
LABEL maintainer="ZeroMQ Project <[email protected]>"
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq \
&& apt-get install -qq --yes --no-install-recommends \
autoconf \
automake \
build-essential \
git \
libkrb5-dev \
libsodium-dev \
libtool \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /opt/libzmq
COPY . .
RUN ./autogen.sh \
&& ./configure --prefix=/usr/local --with-libsodium --with-libgssapi_krb5 \
&& make \
&& make check \
&& make install

MAINTAINER ZeroMQ Project <[email protected]>

RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git build-essential libtool autoconf automake pkg-config unzip libkrb5-dev
RUN cd /tmp && git clone git://github.com/jedisct1/libsodium.git && cd libsodium && git checkout e2a30a && ./autogen.sh && ./configure && make check && make install && ldconfig
RUN cd /tmp && git clone --depth 1 git://github.com/zeromq/libzmq.git && cd libzmq && ./autogen.sh && ./configure && make
# RUN cd /tmp/libzmq && make check
RUN cd /tmp/libzmq && make install && ldconfig
RUN rm /tmp/* -rf
FROM debian:buster-slim
LABEL maintainer="ZeroMQ Project <[email protected]>"
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq \
&& apt-get install -qq --yes --no-install-recommends \
libkrb5-dev \
libsodium23 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local /usr/local
RUN ldconfig && ldconfig -p | grep libzmq

0 comments on commit ddbef32

Please sign in to comment.