Expanded documentation in both English and Chinese READMEs to include detailed container registry acceleration usage and deployment instructions. Refactored Dockerfile to use a multi-stage build with workerd for self-hosted deployment. Improved .dockerignore for cleaner builds. Updated GitHub Actions workflows to refine path ignores and metadata extraction. Added config.capnp for workerd configuration. Removed obsolete .html file and enhanced CLAUDE.md with comprehensive architecture and development guidance.
35 lines
966 B
Docker
35 lines
966 B
Docker
# --- Stage 1: build the Worker with Wrangler -----------------------
|
|
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies & wrangler
|
|
COPY package*.json wrangler.toml ./
|
|
RUN npm ci
|
|
|
|
# Copy source and build
|
|
COPY src ./src
|
|
RUN npx wrangler deploy --dry-run --outdir=dist
|
|
|
|
# --- Stage 2: minimal runtime with workerd -------------------------
|
|
FROM node:22-slim AS runtime
|
|
|
|
# Install ca-certificates for SSL, then install workerd via npm
|
|
RUN apt-get update && \
|
|
apt-get install -y ca-certificates && \
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
npm install -g @cloudflare/workerd-linux-64 && \
|
|
ln -s /usr/local/lib/node_modules/@cloudflare/workerd-linux-64/bin/workerd /usr/local/bin/workerd && \
|
|
workerd --version
|
|
|
|
WORKDIR /worker
|
|
|
|
# Bring in the compiled Worker bundle and config
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY config.capnp ./config.capnp
|
|
|
|
# Expose the port workerd listens on
|
|
EXPOSE 8080
|
|
|
|
CMD ["workerd", "serve", "config.capnp"]
|