Skip to content

Commit

Permalink
Reduce container image size with multi-stage builds
Browse files Browse the repository at this point in the history
Before this patch, Dockerfile.ubuntu was generating an oversized image.

                       Uncompressed size      Compressed size
Before this patch:     1.3GB                  390MB
After this patch:      250MB                  110MB
  • Loading branch information
alban authored and yonghong-song committed Mar 9, 2020
1 parent 9d7feee commit c9cfb52
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Dockerfile.ubuntu
@@ -1,4 +1,4 @@
FROM ubuntu:bionic
FROM ubuntu:bionic as builder

MAINTAINER Brenden Blanco <bblanco@gmail.com>

Expand All @@ -10,7 +10,14 @@ COPY ./ /root/bcc
WORKDIR /root/bcc

RUN /usr/lib/pbuilder/pbuilder-satisfydepends && \
./scripts/build-deb.sh && \
./scripts/build-deb.sh


FROM ubuntu:bionic

COPY --from=builder /root/bcc/*.deb /root/bcc/

RUN \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y python python3 binutils libelf1 && \
dpkg -i /root/bcc/*.deb

0 comments on commit c9cfb52

Please sign in to comment.