2
2

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.

DockerfileのRUNコマンドを繋げて書く

Posted at

RUNをまとめてorつなげて書く

RUNで不要な処理が生まれないように繋げてorまとめて書く
参考
https://qiita.com/c18t/items/f3a911ef01f124071c95

--squashオプションを使えばその限りでは無いようですが…
繋げて書きたい!!

RUNをつなげるにはバックスラッシュ\を使う

改行を繋げるだけなら\でOK
別の処理が入るようなものをつなげるなら追加で&&が必要になります!

RUN  apt-get -y update \
     && apt-get install -y git \
     && yarn global add @vue/cli -g

この時、個人的な好みですが&&が先頭に来るように書くと見やすくてなお良しです。

↓こちらの記事の方も同じ意見のようです。
https://qiita.com/yuyakato/items/4e8616ad83d67e35bc5a

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?