{
 "Dockerfile 基本指令與 docker build#2": {
  "type": "flow",
  "reveal": [
   0,
   3,
   4,
   4
  ],
  "nodes": [
   {
    "label": "Dockerfile",
    "color": 0
   },
   {
    "label": "build context",
    "sub": "目錄 .",
    "color": 1
   },
   {
    "label": "docker build",
    "color": 2
   },
   {
    "label": "命名映像檔",
    "sub": "-t 加版本",
    "color": 3,
    "kind": "end"
   }
  ]
 },
 "Dockerfile 基本指令與 docker build#3": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   4
  ],
  "head": [
   "指令",
   "用途"
  ],
  "rows": [
   [
    "FROM python:3.12-slim",
    "基底映像檔"
   ],
   [
    "WORKDIR /app",
    "設定工作目錄"
   ],
   [
    "COPY app.py .",
    "複製程式進映像"
   ],
   [
    "CMD [\"python\",\"app.py\"]",
    "容器啟動時執行"
   ]
  ],
  "widths": [
   4,
   3
  ]
 },
 "Dockerfile 基本指令與 docker build#6": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3
  ],
  "cards": [
   {
    "title": "RUN",
    "points": [
     "建置時執行",
     "存成新的一層",
     "常用來安裝套件"
    ]
   },
   {
    "title": "ENV",
    "points": [
     "建置與執行都有效",
     "保留在映像檔"
    ]
   },
   {
    "title": "ARG",
    "points": [
     "只在建置時有效",
     "用 --build-arg 傳入"
    ]
   }
  ]
 },
 "Dockerfile 基本指令與 docker build#7": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ],
  "cards": [
   {
    "title": "EXPOSE",
    "points": [
     "宣告埠,僅是說明"
    ]
   },
   {
    "title": "USER",
    "points": [
     "指定執行身分"
    ]
   },
   {
    "title": "CMD",
    "points": [
     "預設指令,可被覆蓋"
    ]
   },
   {
    "title": "ENTRYPOINT",
    "points": [
     "固定進入點"
    ]
   },
   {
    "title": "HEALTHCHECK",
    "points": [
     "檢查容器健康"
    ]
   }
  ]
 },
 "CMD、ENTRYPOINT、ENV、ARG 與 .dockerignore#1": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   3,
   3,
   3
  ],
  "head": [
   "項目",
   "CMD",
   "ENTRYPOINT"
  ],
  "rows": [
   [
    "角色",
    "預設指令或參數",
    "固定執行檔"
   ],
   [
    "run 後接內容",
    "整個被取代",
    "當成參數接在後"
   ],
   [
    "取代方式",
    "直接接新指令",
    "--entrypoint"
   ]
  ],
  "widths": [
   2,
   3,
   3
  ]
 },
 "CMD、ENTRYPOINT、ENV、ARG 與 .dockerignore#2": {
  "type": "table",
  "reveal": [
   0,
   1,
   1,
   2,
   2
  ],
  "head": [
   "形式",
   "寫法",
   "一號程序",
   "docker stop"
  ],
  "rows": [
   [
    "exec",
    "JSON 陣列",
    "程式本身",
    "收得到訊號"
   ],
   [
    "shell",
    "直接寫指令",
    "sh",
    "等 10 秒被強殺"
   ]
  ],
  "widths": [
   2,
   3,
   3,
   3
  ]
 },
 "CMD、ENTRYPOINT、ENV、ARG 與 .dockerignore#3": {
  "type": "table",
  "reveal": [
   0,
   1,
   2
  ],
  "head": [
   "指令",
   "行為",
   "建議"
  ],
  "rows": [
   [
    "COPY",
    "複製檔案或目錄",
    "優先使用"
   ],
   [
    "ADD",
    "自動解壓 tar、可下載網址",
    "需解壓縮才用"
   ]
  ],
  "widths": [
   2,
   4,
   3
  ]
 },
 "CMD、ENTRYPOINT、ENV、ARG 與 .dockerignore#4": {
  "type": "table",
  "reveal": [
   0,
   2,
   2,
   3,
   3
  ],
  "head": [
   "項目",
   "ENV",
   "ARG"
  ],
  "rows": [
   [
    "作用期間",
    "建置與執行",
    "只在建置"
   ],
   [
    "覆蓋方式",
    "docker run -e",
    "--build-arg"
   ],
   [
    "放密碼",
    "history 看得到",
    "history 看得到"
   ]
  ],
  "widths": [
   2,
   3,
   3
  ]
 },
 "CMD、ENTRYPOINT、ENV、ARG 與 .dockerignore#5": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   3
  ],
  "cards": [
   {
    "title": "加快建置",
    "points": [
     "不送 node_modules、.git"
    ]
   },
   {
    "title": "避免洩漏",
    "points": [
     ".env、私鑰不被 COPY"
    ]
   },
   {
    "title": "提高快取命中",
    "points": [
     "無關檔案變動不失效"
    ]
   }
  ]
 },
 "CMD、ENTRYPOINT、ENV、ARG 與 .dockerignore#6": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5,
   6
  ],
  "head": [
   "排除項目",
   "說明"
  ],
  "rows": [
   [
    ".git",
    "版本控制資料夾"
   ],
   [
    ".env",
    "通常放密碼與金鑰"
   ],
   [
    "*.log",
    "所有日誌檔"
   ],
   [
    "node_modules",
    "Node 套件目錄"
   ],
   [
    "__pycache__",
    "Python 快取目錄"
   ],
   [
    "Dockerfile",
    "映像檔裡不需要"
   ]
  ],
  "widths": [
   3,
   4
  ]
 },
 "實戰:容器化應用與多階段建置#1": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "cards": [
   {
    "title": "PYTHONUNBUFFERED",
    "points": [
     "輸出立刻寫到 stdout",
     "docker logs 才即時"
    ]
   },
   {
    "title": "--no-cache-dir",
    "points": [
     "pip 不留快取",
     "縮小映像體積"
    ]
   },
   {
    "title": "非 root 使用者",
    "points": [
     "被入侵危害較小"
    ]
   },
   {
    "title": "綁 0.0.0.0",
    "points": [
     "綁本機位址會連不進來",
     "-p 對應也失效"
    ]
   }
  ]
 },
 "實戰:容器化應用與多階段建置#6": {
  "type": "flow",
  "reveal": [
   0,
   1,
   2,
   3
  ],
  "nodes": [
   {
    "label": "docker build",
    "sub": "-t my-app:1.0",
    "color": 0
   },
   {
    "label": "docker run -d",
    "sub": "-p 8000:8000",
    "color": 1
   },
   {
    "label": "curl 8000",
    "sub": "收到回應",
    "color": 2,
    "kind": "end"
   }
  ]
 }
}