- src/main.rs:零第三方依赖的 HTTP/1.1 服务,提供 /、/api/info、/health、 /api/hello、/page;App 用 Arc 共享后 clone 进 thread::spawn,保证 'static - Dockerfile:依赖预热层的桩产物放到 /tmp/deps-target,避免与正式编译 共用 /src/target 时被判定 up-to-date、把桩二进制拷进运行镜像;运行阶段 增加 grep 启动日志的构建期自检 - docker-compose.yml:固定 IP 172.31.2.20,端口 8088,netstat 健康检查
12 lines
322 B
Bash
Executable File
12 lines
322 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# 在示例目录下构建示例镜像(编译 + 运行两阶段均在本机 docker 内完成)
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
IMAGE=${IMAGE:-registry.cn-shanghai.aliyuncs.com/odboy/kenaito:demo-rust}
|
|
docker build -t "${IMAGE}" .
|
|
|
|
if [ "${PUSH:-0}" = "1" ]; then
|
|
docker push "${IMAGE}"
|
|
fi
|