0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

alpineでビルド、scratchを最終ベースイメージとするマルチステージビルド

0
Last updated at Posted at 2019-11-17

どの程度ファイルサイズが減るのか。調べてみた。

TL;DR;

  • 圧縮前で2.6MB削減
  • 解凍後サイズで6MB削減

手順

alpineのみをベースイメージとした時と、alpineでビルドしscratchでイメージ作成した場合を比較

-- FROM alpine:3.10.3
++ FROM alpine:3.10.3 as builder
   RUN wget -O - 'https://github.com/ktr0731/evans/releases/download/0.8.4/evans_linux_amd64.tar.gz' | tar zxvf -
++ FROM scratch
++ COPY --from=builder /evans /evans
   ENTRYPOINT ["/evans"]

結果

before after
圧縮時のサイズ 12.48MB 9.82MB
解凍後のイメージサイズ 27.3MB 21.3MB
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?