File size: 920 Bytes
af9d2af b7bc792 9dbc47e b7bc792 af9d2af b7bc792 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# 使用 Node.js 官方镜像作为基础镜像
FROM node:latest
# 设置工作目录
WORKDIR /usr/src/app
# 克隆 Telegraph-Image 仓库
RUN git clone https://github.com/cf-pages/Telegraph-Image .
# 安装 Cloudflare Worker CLI
RUN npm install -g wrangler
# 创建 wrangler 配置文件
RUN echo '{ \
"name": "telegraph-image", \
"type": "webpack", \
"account_id": "", \
"workers_dev": true, \
"route": "", \
"zone_id": "", \
"kv_namespaces": [ \
{ \
"binding": "img_url", \
"id": "fake_id", \
"preview_id": "" \
} \
] \
}' > wrangler.toml
# 暴露 8080 端口
EXPOSE 8080
# 设置环境变量
ENV BASIC_USER=admin
ENV BASIC_PASS=123
# 运行 Cloudflare Worker 本地开发环境
CMD ["wrangler", "pages", "dev", "./", "--kv", "img_url", "--port", "8080", "--binding", "BASIC_USER=admin", "--binding", "BASIC_PASS=123", "--persist-to", "./data", "--log-level", "info"]
|