theoremoon / ShellgeiBot

シェル芸を実行しちゃう危険なbot
Apache License 2.0
170 stars 15 forks source link

Dockerイメージのビルドを高速化したい #16

Closed 3socha closed 5 years ago

3socha commented 5 years ago

背景

測定

``` [+] Building 1397.9s (57/57) FINISHED => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 6.91kB 0.0s => [internal] load metadata for docker.io/library/ubuntu:19.04 3.0s => [1/53] FROM docker.io/library/ubuntu:19.04@sha256:4319d5df5619d6e2e4c94158eb9929bf2f59ce217aa8fed72fb6e1b57 5.5s => => resolve docker.io/library/ubuntu:19.04@sha256:4319d5df5619d6e2e4c94158eb9929bf2f59ce217aa8fed72fb6e1b577 0.0s => => sha256:4319d5df5619d6e2e4c94158eb9929bf2f59ce217aa8fed72fb6e1b57757c859 2.04kB / 2.04kB 0.0s => => sha256:3eeb73c0d4cd3e1ca3615d128f11d21ebbc2b08ada0ae70d456abc275ce96a80 1.15kB / 1.15kB 0.0s => => sha256:f723e3b6f1bdb728157b96a1f9e9985f7191721c6e9d410b80798e8171b7d2c6 3.40kB / 3.40kB 0.0s => => sha256:7eab35e32a16ff1387d61b34bddec80cc134f691c428065bdb4c81a3a339fb44 29.76MB / 29.76MB 4.0s => => sha256:9c0b49bd5b97141e4edf0018e1345d0e6d44ab1a80ac86c753ef7ca1f96f6284 864B / 864B 1.7s => => sha256:76ea149966fabba8a80d6f2c9f22589f7b851f60ca712e844bdd67038a63e554 193B / 193B 1.5s => => sha256:d56480354398151b0726ab0aa1e02a6c51ebfbada0eaa3611748d4d27c3c05ce 163B / 163B 2.0s => => extracting sha256:7eab35e32a16ff1387d61b34bddec80cc134f691c428065bdb4c81a3a339fb44 0.8s => => extracting sha256:9c0b49bd5b97141e4edf0018e1345d0e6d44ab1a80ac86c753ef7ca1f96f6284 0.0s => => extracting sha256:76ea149966fabba8a80d6f2c9f22589f7b851f60ca712e844bdd67038a63e554 0.0s => => extracting sha256:d56480354398151b0726ab0aa1e02a6c51ebfbada0eaa3611748d4d27c3c05ce 0.0s => [2/53] RUN apt-get update -y && apt-get install -y ruby ruby-dev ccze screen tmux tt 582.5s => [3/53] RUN gem install cureutils matsuya takarabako snacknomama rubipara marky_markov 21.3s => [4/53] RUN pip3 install yq faker sympy numpy scipy matplotlib xonsh pillow asciinema "https://github.com/ 148.4s => [5/53] RUN pip install sympy numpy scipy matplotlib pillow 23.0s => [6/53] RUN curl -OL --retry 3 https://git.io/egison-3.7.14.x86_64.deb && dpkg -i ./egison-3.7.14.x86_64.deb 6.5s => [7/53] RUN curl -OL --retry 3 https://git.io/egzact-1.3.1.deb && dpkg -i ./egzact-1.3.1.deb && rm ./egzact- 2.9s => [8/53] RUN npm install -g faker-cli chemi 3.8s => [9/53] RUN git clone https://github.com/fumiyas/home-commands.git 2.0s => [10/53] RUN rm /home-commands/README.md 0.8s => [11/53] RUN wget http://www.jsoftware.com/download/j807/install/j807_linux64_nonavx.tar.gz -O j.tar.gz && t 4.1s => [12/53] RUN wget https://github.com/noborus/trdsql/releases/download/v0.5.0/trdsql_linux_amd64.zip && unzip 6.7s => [13/53] RUN rm trdsql_linux_amd64.zip 0.8s => [14/53] RUN wget https://download.oracle.com/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz -O op 22.6s => [15/53] RUN rm openjdk11.tar.gz 0.7s => [16/53] RUN curl -OL --retry 3 https://git.io/superunko.deb && dpkg -i superunko.deb && rm superunko.deb 2.2s => [17/53] RUN wget https://gist.githubusercontent.com/KeenS/6194e6ef1a151c9ea82536d5850b8bc7/raw/85af9ec75730 1.0s => [18/53] RUN wget https://dl.google.com/go/go1.12.linux-amd64.tar.gz -O go.tar.gz && tar xzf go.tar.gz -C / 15.9s => [19/53] RUN mkdir /root/go 0.7s => [20/53] RUN go get -u github.com/YuheiNakasaka/sayhuuzoku && ln -s /root/go/src/github.com/YuheiNakasaka/ 174.8s => [21/53] RUN go get -u github.com/tomnomnom/gron 12.5s => [22/53] RUN go get -u github.com/ericchiang/pup 5.1s => [23/53] RUN go get -u github.com/sugyan/ttyrec2gif 11.2s => [24/53] RUN go get -u github.com/xztaityozx/owari 10.1s => [25/53] RUN go get -u github.com/jiro4989/align 2.9s => [26/53] RUN go get -u github.com/jiro4989/taishoku 3.1s => [27/53] RUN go get -u github.com/jiro4989/textimg 3.8s => [28/53] RUN git clone https://github.com/hostilefork/whitespacers.git && cp /whitespacers/ruby/whitespace.r 2.5s => [29/53] RUN git clone https://github.com/usp-engineers-community/Open-usp-Tukubai 8.5s => [30/53] RUN make install 1.0s => [31/53] RUN wget -O julia.tar.gz https://julialang-s3.julialang.org/bin/linux/x64/1.1/julia-1.1.0-linux-x8 15.8s => [32/53] RUN curl https://sh.rustup.rs -sSf | sh -s -- -y 29.7s => [33/53] RUN cargo install --git https://github.com/lotabout/rargs.git 52.7s => [34/53] RUN git clone https://github.com/ryuichiueda/ShellGeiData 8.4s => [35/53] RUN git clone https://github.com/ryuichiueda/ImageGeneratorForShBot 1.8s => [36/53] RUN /etc/init.d/nginx start 0.8s => [37/53] RUN wget https://raintrees.net/attachments/download/486/zws && chmod a+x ./zws 1.4s => [38/53] RUN wget https://pkg.osquery.io/deb/osquery_3.3.2_1.linux.amd64.deb -O osquery.deb && dpkg -i osque 4.4s => [39/53] RUN wget https://github.com/o2sh/onefetch/releases/download/v1.5.2/onefetch_linux_x86-64.zip && unz 5.7s => [40/53] RUN wget -nv https://raw.githubusercontent.com/redpeacock78/sushiro/master/sushiro && install -m 07 1.9s => [41/53] RUN wget https://raw.githubusercontent.com/xztaityozx/noc/master/noc/noc/Program.cs && mcs Program. 1.7s => [42/53] RUN wget https://github.com/sharkdp/bat/releases/download/v0.10.0/bat_0.10.0_amd64.deb && dpkg -i b 3.7s => [43/53] RUN curl -OL --retry 3 https://git.io/echo-meme.deb && dpkg -i echo-meme.deb && rm echo-meme.deb 2.0s => [44/53] RUN wget ftp://ftp.gnu.org/pub/gnu/bash/bash-5.0.tar.gz && tar xf bash-5.0.tar.gz && rm bash-5.0.ta 9.9s => [45/53] RUN ./configure && make && make install 51.8s => [46/53] RUN rm -rf bash-5.0 1.7s => [47/53] RUN curl -OL --retry 3 https://ftp.gnu.org/gnu/gawk/gawk-5.0.0.tar.gz && tar -xpzf gawk-5.0.0.tar.g 5.2s => [48/53] RUN ./configure --program-suffix="-5.0.0" && make && make install 28.6s => [49/53] RUN rm -rf gawk-5.0.0 0.8s => [50/53] RUN curl -L --retry 3 "https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=localedata/locales/ja 5.8s => [51/53] RUN curl -O https://www.unicode.org/Public/UCD/latest/ucd/NormalizationTest.txt 4.5s => [52/53] RUN curl -O https://www.unicode.org/Public/UCD/latest/ucd/NamesList.txt 5.5s => [53/53] RUN CGO_LDFLAGS="`mecab-config --libs`" CGO_CFLAGS="-I`mecab-config --inc-dir`" go get -u github.co 4.1s => exporting to image 59.4s => => exporting layers 59.3s => => writing image sha256:751317a53ba96f17dd848360679374ddff621c38d883b2f9d2c35d575a850067 0.0s => => naming to docker.io/library/shellgeibot 0.0s ```
3socha commented 5 years ago
``` [+] Building 1014.7s (79/79) FINISHED => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 37B 0.0s => [internal] load metadata for docker.io/library/golang:1.12-stretch 0.0s => [internal] load metadata for docker.io/library/ubuntu:19.04 0.0s => CACHED [internal] helper image for file operations 0.0s => CACHED [runtime 1/38] FROM docker.io/library/ubuntu:19.04 0.0s => [ruby-builder 2/8] RUN apt update -qq 10.4s => CACHED [go-builder 1/12] FROM docker.io/library/golang:1.12-stretch 0.0s => [go-builder 2/12] RUN apt update -qq 5.3s => [runtime 2/38] RUN apt update -qq && apt-get install -y ruby ccze screen tmux ttyrec 724.1s => [go-builder 3/12] RUN apt install -y -qq libmecab-dev 2.2s => [go-builder 4/12] RUN go get -u github.com/YuheiNakasaka/sayhuuzoku 393.4s => [ruby-builder 3/8] RUN apt install -y -qq curl 9.7s => [nodejs-builder 3/5] RUN apt install -y -qq nodejs 14.7s => [python-builder 3/6] RUN apt install -y -qq python-dev python-pip python-mecab python3-dev python3-pip 115.4s => [ruby-builder 4/8] RUN apt install -y -qq build-essential 42.5s => [dotnet-builder 4/7] RUN apt install -y -qq git 18.8s => [nodejs-builder 4/5] RUN apt install -y -qq npm 90.7s => [dotnet-builder 5/7] RUN apt install -y -qq mono-mcs 81.0s => [ruby-builder 5/8] RUN apt install -y -qq ruby ruby-dev 41.0s => [gawk-builder 5/9] RUN curl -sfSLO https://ftp.gnu.org/gnu/gawk/gawk-5.0.0.tar.gz 33.8s => [gawk-builder 6/9] RUN tar xf gawk-5.0.0.tar.gz 1.3s => [gawk-builder 7/9] RUN ./configure --program-suffix="-5.0.0" 22.6s => [ruby-builder 6/8] RUN gem install --quiet --no-ri --no-rdoc cureutils matsuya takarabako snacknomama rubi 12.9s => [nodejs-builder 5/5] RUN npm install -g --silent faker-cli chemi 4.9s => [ruby-builder 7/8] RUN curl -sfSL --retry 3 https://raw.githubusercontent.com/hostilefork/whitespacers/mast 1.8s => [ruby-builder 8/8] RUN chmod +x /usr/local/bin/whitespace 0.8s => [dotnet-builder 6/7] RUN git clone --depth 1 https://github.com/xztaityozx/noc.git 2.8s => [gawk-builder 8/9] RUN make 23.3s => [dotnet-builder 7/7] RUN mcs noc/noc/noc/Program.cs 2.2s => [python-builder 4/6] RUN pip install --quiet sympy numpy scipy matplotlib pillow 36.7s => [gawk-builder 9/9] RUN make install 2.0s => [python-builder 5/6] RUN pip3 install --quiet yq faker sympy numpy scipy matplotlib xonsh pillow asciinema 31.0s => [python-builder 6/6] RUN pip3 install --quiet "https://github.com/megagonlabs/ginza/releases/download/v1. 128.9s => [go-builder 5/12] RUN go get -u github.com/tomnomnom/gron 13.8s => [go-builder 6/12] RUN go get -u github.com/ericchiang/pup 7.0s => [go-builder 7/12] RUN go get -u github.com/sugyan/ttyrec2gif 12.8s => [go-builder 8/12] RUN go get -u github.com/xztaityozx/owari 14.1s => [go-builder 9/12] RUN go get -u github.com/jiro4989/align 2.9s => [go-builder 10/12] RUN go get -u github.com/jiro4989/taishoku 2.9s => [go-builder 11/12] RUN go get -u github.com/jiro4989/textimg 6.6s => [go-builder 12/12] RUN CGO_LDFLAGS="`mecab-config --libs`" CGO_CFLAGS="-I`mecab-config --inc-dir`" go get - 4.0s => [runtime 3/38] RUN curl -sfSL --retry 3 https://download.oracle.com/java/GA/jdk11/9/GPL/openjdk-11.0.2_lin 20.1s => [runtime 4/38] RUN curl -sfSL --retry 3 https://julialang-s3.julialang.org/bin/linux/x64/1.1/julia-1.1.0-l 14.0s => [runtime 5/38] RUN curl -sfSL https://sh.rustup.rs | sh -s -- -y 28.0s => [runtime 6/38] RUN cargo install --git https://github.com/lotabout/rargs.git 54.9s => [runtime 7/38] RUN curl -sfSL --retry 3 http://www.jsoftware.com/download/j807/install/j807_linux64_nonavx. 3.6s => [runtime 8/38] RUN git clone --depth 1 https://github.com/fumiyas/home-commands.git && cd home-commands 2.1s => [runtime 9/38] RUN curl -sfSLO --retry 3 https://github.com/noborus/trdsql/releases/download/v0.5.0/trdsql_ 6.9s => [runtime 10/38] RUN curl -sfSLO --retry 3 https://git.io/superunko.deb && dpkg -i superunko.deb && 2.5s => [runtime 11/38] RUN curl -sfSLO https://gist.githubusercontent.com/KeenS/6194e6ef1a151c9ea82536d5850b8bc7/r 1.0s => [runtime 12/38] RUN git clone --depth 1 https://github.com/usp-engineers-community/Open-usp-Tukubai.git 5.6s => [runtime 13/38] RUN git clone --depth 1 https://github.com/ryuichiueda/ShellGeiData.git 7.0s => [runtime 14/38] RUN git clone --depth 1 https://github.com/ryuichiueda/ImageGeneratorForShBot.git 1.8s => [runtime 15/38] RUN curl -sfSLO https://raintrees.net/attachments/download/486/zws && chmod +x zws 24.7s => [runtime 16/38] RUN curl -sfSL https://pkg.osquery.io/deb/osquery_3.3.2_1.linux.amd64.deb -o osquery.deb 2.3s => [runtime 17/38] RUN curl -sfSLO https://github.com/o2sh/onefetch/releases/download/v1.5.2/onefetch_linux_x8 3.8s => [runtime 18/38] RUN curl -sfSL https://raw.githubusercontent.com/redpeacock78/sushiro/master/sushiro -o /us 1.1s => [runtime 19/38] RUN curl -sfSLO https://github.com/sharkdp/bat/releases/download/v0.10.0/bat_0.10.0_amd64.d 4.4s => [runtime 20/38] RUN curl -sfSLO --retry 3 https://git.io/echo-meme.deb && dpkg -i echo-meme.deb && 2.1s => [runtime 21/38] RUN curl -sfSLO https://www.unicode.org/Public/UCD/latest/ucd/NormalizationTest.txt 4.5s => [runtime 22/38] RUN curl -sfSLO https://www.unicode.org/Public/UCD/latest/ucd/NamesList.txt 3.4s => [runtime 23/38] RUN curl -sfSL --retry 3 https://dl.google.com/go/go1.12.linux-amd64.tar.gz -o go.tar.gz 15.3s => [runtime 24/38] COPY --from=go-builder /go/bin /root/go/bin 1.0s => [runtime 25/38] COPY --from=go-builder /go/src/github.com/YuheiNakasaka/sayhuuzoku/db/data.db /root/go/src/ 0.9s => [runtime 26/38] RUN ln -s /root/go/src/github.com/YuheiNakasaka/sayhuuzoku/db / 0.8s => [runtime 27/38] COPY --from=ruby-builder /usr/local/bin /usr/local/bin 0.8s => [runtime 28/38] COPY --from=ruby-builder /var/lib/gems /var/lib/gems 1.3s => [runtime 29/38] COPY --from=python-builder /usr/lib/python2.7/dist-packages /usr/lib/python2.7/dist-package 1.6s => [runtime 30/38] COPY --from=python-builder /usr/local/bin /usr/local/bin 1.0s => [runtime 31/38] COPY --from=python-builder /usr/local/lib/python2.7 /usr/local/lib/python2.7 3.9s => [runtime 32/38] COPY --from=python-builder /usr/local/lib/python3.7 /usr/local/lib/python3.7 7.2s => [runtime 33/38] RUN curl -sfSLO --retry 3 https://git.io/egison-3.7.14.x86_64.deb && dpkg -i ./egison-3 6.5s => [runtime 34/38] RUN curl -sfSLO --retry 3 https://git.io/egzact-1.3.1.deb && dpkg -i ./egzact-1.3.1.deb 3.0s => [runtime 35/38] COPY --from=nodejs-builder /usr/local/bin /usr/local/bin 0.7s => [runtime 36/38] COPY --from=nodejs-builder /usr/local/lib/node_modules /usr/local/lib/node_modules 1.5s => [runtime 37/38] COPY --from=dotnet-builder /noc/noc/noc/Program.exe /noc 1.4s => [runtime 38/38] COPY --from=gawk-builder /usr/local /usr/local 1.1s => exporting to image 48.4s => => exporting layers 48.4s => => writing image sha256:f7f928537ae361d37d1e5c3c7ecc8ea336b367961ae2ac967a3f5ceecd3dc400 0.0s => => naming to docker.io/library/shellgeibot 0.0s ```

メモ:

theoremoon commented 5 years ago

@horo17 うわーありがたいです!! :pray:

DockerHubにシェル芸botのイメージを公開したのはCircleCIを利用した自動ビルド & push をやるためなので、ストレージサイズもdocker hostのバージョンも心配ないです(たぶん)。

このまま進めてもらって :ok_woman: です。私がこのあたりに明るくないのでmergeできるタイミングになったら教えてください