{
 "映像檔瘦身:基底選擇、多階段與快取#1": {
  "type": "cards",
  "reveal": [
   0,
   0,
   1,
   2,
   3,
   4,
   4
  ],
  "cards": [
   {
    "title": "完整版",
    "points": [
     "Debian 為基礎",
     "工具齊全",
     "數百 MB"
    ]
   },
   {
    "title": "slim",
    "points": [
     "移除非必要套件",
     "仍用 glibc",
     "相容性好"
    ]
   },
   {
    "title": "alpine",
    "points": [
     "基底只有幾 MB",
     "musl 與 busybox",
     "可能不相容"
    ]
   },
   {
    "title": "distroless/scratch",
    "points": [
     "只有你的程式",
     "無 shell",
     "適合 Go、Rust"
    ]
   }
  ]
 },
 "映像檔瘦身:基底選擇、多階段與快取#2": {
  "type": "bar",
  "reveal": [
   0,
   0,
   0,
   1,
   2,
   3
  ],
  "labels": [
   "完整版",
   "slim",
   "alpine"
  ],
  "values": [
   1000,
   130,
   50
  ],
  "unit": "MB",
  "highlight": 2
 },
 "映像檔瘦身:基底選擇、多階段與快取#3": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   3
  ],
  "cards": [
   {
    "title": "關閉 CGO",
    "points": [
     "不依賴 C 函式庫",
     "才能放進 scratch"
    ]
   },
   {
    "title": "USER 用數字",
    "points": [
     "scratch 沒有帳號檔",
     "例如 65534:65534"
    ]
   },
   {
    "title": "沒有 shell",
    "points": [
     "docker exec 開 sh 會失敗",
     "這是正常的"
    ]
   }
  ]
 },
 "映像檔瘦身:基底選擇、多階段與快取#4": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ],
  "head": [
   "行",
   "內容"
  ],
  "rows": [
   [
    "第一行",
    "# syntax=docker/dockerfile:1"
   ],
   [
    "FROM",
    "golang:1.23-alpine AS build"
   ],
   [
    "WORKDIR",
    "/src"
   ],
   [
    "COPY",
    "go.mod ./"
   ],
   [
    "COPY",
    "main.go ./"
   ]
  ]
 },
 "映像檔瘦身:基底選擇、多階段與快取#5": {
  "type": "flow",
  "layout": "row",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "nodes": [
   {
    "label": "go build",
    "sub": "CGO_ENABLED=0"
   },
   {
    "label": "FROM scratch",
    "sub": "全新第二階段"
   },
   {
    "label": "COPY --from",
    "sub": "只取執行檔"
   },
   {
    "label": "USER",
    "sub": "65534:65534",
    "kind": "end"
   }
  ]
 },
 "映像檔瘦身:基底選擇、多階段與快取#7": {
  "type": "table",
  "reveal": [
   0,
   1,
   4,
   4,
   5
  ],
  "head": [
   "做法",
   "說明"
  ],
  "rows": [
   [
    "--no-install-recommends",
    "apt-get 不裝建議套件"
   ],
   [
    "清除 apt 快取清單",
    "裝完同一 RUN 內刪除"
   ],
   [
    "pip --no-cache-dir",
    "不留 pip 快取"
   ],
   [
    "npm ci --omit=dev",
    "略過開發用套件"
   ],
   [
    "update 與 install",
    "寫在同一個 RUN"
   ]
  ]
 },
 "容器安全最佳實務#3": {
  "type": "table",
  "reveal": [
   0,
   0,
   1,
   1,
   2
  ],
  "head": [
   "基底",
   "建立使用者"
  ],
  "rows": [
   [
    "Debian / Ubuntu",
    "groupadd + useradd,USER app"
   ],
   [
    "Alpine",
    "addgroup -S + adduser -S"
   ]
  ]
 },
 "容器安全最佳實務#6": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ],
  "head": [
   "選項",
   "用途"
  ],
  "rows": [
   [
    "--read-only --tmpfs /tmp",
    "唯讀根目錄,留暫存"
   ],
   [
    "--cap-drop ALL",
    "拿掉所有特權"
   ],
   [
    "no-new-privileges",
    "禁止提升權限"
   ],
   [
    "--pids-limit 200",
    "--memory 256m --cpus 1"
   ],
   [
    "-p 127.0.0.1:8080:8080",
    "只發布在本機"
   ]
  ]
 },
 "容器安全最佳實務#7": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ],
  "cards": [
   {
    "title": "--read-only",
    "points": [
     "防止竄改檔案",
     "需寫入用 tmpfs 或 volume"
    ]
   },
   {
    "title": "--cap-drop ALL",
    "points": [
     "移除所有 capabilities",
     "需要的再 --cap-add"
    ]
   },
   {
    "title": "no-new-privileges",
    "points": [
     "禁止 setuid 提權"
    ]
   },
   {
    "title": "資源上限",
    "points": [
     "避免耗盡主機資源"
    ]
   },
   {
    "title": "避免 --privileged",
    "points": [
     "幾乎關掉所有隔離"
    ]
   }
  ]
 },
 "Registry:標記、推送與私有倉庫#1": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "cards": [
   {
    "title": "Docker Hub",
    "points": [
     "最大公開 registry",
     "支援私有倉庫"
    ]
   },
   {
    "title": "GitHub / GitLab",
    "points": [
     "與程式碼平台整合",
     "搭配 CI"
    ]
   },
   {
    "title": "雲端廠商",
    "points": [
     "AWS、Google、Azure"
    ]
   },
   {
    "title": "自己架",
    "points": [
     "官方 registry 映像",
     "Harbor 企業級"
    ]
   }
  ]
 },
 "Registry:標記、推送與私有倉庫#2": {
  "type": "table",
  "reveal": [
   0,
   0,
   0,
   1,
   2,
   3
  ],
  "head": [
   "目標",
   "完整名稱"
  ],
  "rows": [
   [
    "Docker Hub",
    "docker.io/myorg/web:1.0"
   ],
   [
    "GitHub",
    "ghcr.io/myorg/web:1.0"
   ],
   [
    "本機 registry",
    "localhost:5000/web:1.0"
   ]
  ]
 },
 "Registry:標記、推送與私有倉庫#4": {
  "type": "flow",
  "layout": "row",
  "reveal": [
   0,
   1,
   1,
   1,
   2,
   3
  ],
  "nodes": [
   {
    "label": "docker login",
    "sub": "-u 帳號,貼上權杖"
   },
   {
    "label": "docker tag",
    "sub": "my app 加上帳號名"
   },
   {
    "label": "docker push",
    "sub": "推上 registry",
    "kind": "end"
   }
  ]
 },
 "Registry:標記、推送與私有倉庫#6": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ],
  "head": [
   "原則",
   "做法"
  ],
  "rows": [
   [
    "不可變版本號",
    "語意化版本,如 1.4.2"
   ],
   [
    "對應程式碼",
    "加 Git commit 短雜湊"
   ],
   [
    "環境標籤",
    "不當唯一識別"
   ],
   [
    "不覆蓋標籤",
    "避免同 tag 不同內容"
   ],
   [
    "latest",
    "正式用明確版本或 digest"
   ]
  ]
 },
 "Registry:標記、推送與私有倉庫#7": {
  "type": "table",
  "reveal": [
   0,
   0,
   1,
   2,
   3,
   4
  ],
  "head": [
   "重點",
   "說明"
  ],
  "rows": [
   [
    "localhost:5000",
    "預設允許不用 HTTPS"
   ],
   [
    "給其他主機用",
    "必須設 TLS 與帳號驗證"
   ],
   [
    "insecure registry",
    "不建議,傳輸可被竄改"
   ],
   [
    "正式用途",
    "雲端 registry 或 Harbor"
   ]
  ]
 }
}