feat(ci): Dockerfile 补默认 CMD 与 EXPOSE,docker run 即起 preview
CI / check (pull_request) Successful in 3m54s

此前镜像没有默认命令,必须手工拼 yarn workspace @stack/tutorial preview 并显式传
--host 0.0.0.0 才能被端口映射访问。补上 EXPOSE 9910 与默认 CMD,docker run -p 9910:9910
镜像 即可伺服 dist。头注释的构建工具由 buildah 更正为 kaniko。
This commit is contained in:
arnold.cui-agent committed 2026-12-03 12:50:46 +08:00
1 parent 726215521c
commit 9f6dd2ddca
1 file changed
+6 -1
+6 -1
View File
@@ -1,4 +1,4 @@
# 教程站构建镜像——CI 用 buildah(无 daemon)执行,本地 docker/podman build 同样可用。
# 教程站构建镜像——CI 用 kaniko 执行(job 容器内直接跑 /kaniko/executor),本地 docker/podman build 同样可用。
# 基座=自家阿里云镜像仓(idealjs/node,由官方 node:24.21.0-bookworm-slim 转推;私有仓,需 login)。
# 默认公网端点(本地可用);阿里云同 region 的 CI 传 --build-arg BASE_REGISTRY=registry-vpc.cn-hangzhou.aliyuncs.com 走内网。
ARG BASE_REGISTRY=registry.cn-hangzhou.aliyuncs.com
@@ -32,3 +32,8 @@ RUN node .yarn/releases/yarn-4.9.2.cjs install --immutable
# ③ 打包——monorepo 全量源码(.dockerignore 瘦身,无 node_modules/dist);产物在 /app/apps/tutorial/dist
COPY . .
RUN node .yarn/releases/yarn-4.9.2.cjs workspace @stack/tutorial build
# ④ 伺服——默认起 preview 托管 dist;--host 0.0.0.0 才能被端口映射访问到。
# playground 沙箱运行时由构建时 VITE_STACK_RUNTIME_ORIGIN 决定(见 apps/tutorial/.env.development),换部署域名需重新构建。
EXPOSE 9910
CMD ["node", ".yarn/releases/yarn-4.9.2.cjs", "workspace", "@stack/tutorial", "preview", "--port", "9910", "--host", "0.0.0.0"]