diff --git a/README.md b/README.md index 7f80b43..ac5f3bc 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,32 @@ curl -fsSL https://get.pnpm.io/install.sh | sh - pnpm install ``` +## Podman Compose + +### 构建 + +先构建镜像(只需要一次,或代码变动时重建) + +```sh +podman build -t cf-workers-dev . +``` + +### 常用命令 + +```sh +# 第一次启动(会自动构建镜像) +podman-compose up -d + +# 停止 +podman-compose down + +# 查看日志 +podman-compose logs -f + +# 重启(代码改动后一般不需要重建,只需重启容器) +podman-compose restart workers +``` + ### Windows ```sh diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..6d75a24 --- /dev/null +++ b/compose.yml @@ -0,0 +1,19 @@ +services: + workers: + image: cf-workers-dev:latest + build: + context: . + dockerfile: Dockerfile + container_name: cf-workers-dev + ports: + - "8787:8787" # 本地访问 Workers 预览 + - "8976:8976" # 可选:Wrangler 的 dashboard(如果用了 --inspect) + volumes: + - .:/app # 代码实时挂载,改动无需重启 + - podman-node-modules:/app/node_modules # 持久化 node_modules,避免重复安装 + command: + ["npx", "wrangler", "dev", "--local", "--ip", "0.0.0.0", "--port", "8787"] + restart: unless-stopped + +volumes: + podman-node-modules: