Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor by Dockerfile Best Practices #1

Open
chusiang opened this issue Jul 4, 2019 · 0 comments
Open

Refactor by Dockerfile Best Practices #1

chusiang opened this issue Jul 4, 2019 · 0 comments
Assignees

Comments

@chusiang
Copy link
Owner

chusiang commented Jul 4, 2019

Dockerfile Best Practices:

  1. 執行順序對於 Cache 很有事。
  2. 只 COPY 必要的東西就好,避免破壞已經 Cache 的 Unit。
  3. 讓比較不變動的 RUN 命令集中在一起方便 Cache。
  4. 不要安裝不必要的東西,例如 ssh, vim。
  5. 記得移除掉安裝過程中的暫存檔案。
  6. 盡量使用各種官方提供的 Base Image,而不是自己硬來。
  7. Base Image 盡量指定好特定版本,而不是用 latest。
  8. 使用容量最小的 Base Image。
  9. Base Image 選擇 Application 夠用的就好,不用選包山包海的。
  10. 把相依套件的安裝用一個獨立的 RUN Cache 起來。

Reference:

@chusiang chusiang self-assigned this Jul 4, 2019
chusiang added a commit that referenced this issue Jul 4, 2019
Reduce image size by remove install vim flow.
chusiang added a commit that referenced this issue Jul 4, 2019
Reduce image size by remove install vim flow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant