-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathDockerfile.qwen-code-build
More file actions
40 lines (34 loc) · 1.58 KB
/
Dockerfile.qwen-code-build
File metadata and controls
40 lines (34 loc) · 1.58 KB
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
40
# ====================================================================
# Node.js 20 Build Environment for Qwen Code
# ====================================================================
# Produces pre-built qwen-code bundles that can be installed globally
# without triggering prepare scripts (which require husky).
#
# Uses BuildKit cache mounts for npm download cache and layer caching
# for dependencies (npm ci only re-runs when package manifests change).
#
# Usage: ./stack build-qwen-code
# ====================================================================
FROM node:20-slim AS builder
# Install git (required for simple-git dependency)
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Copy package manifests and workspace packages first for layer caching.
# npm ci only re-runs when these files change.
COPY package.json package-lock.json ./
COPY packages/ ./packages/
# Install dependencies — cached as a Docker layer when manifests unchanged.
# --ignore-scripts skips husky prepare hooks.
# Cache mount keeps npm download cache across builds even when layer is rebuilt.
RUN --mount=type=cache,target=/root/.npm \
npm ci --ignore-scripts
# Copy remaining source and build the bundle.
COPY . .
RUN npm run bundle
# Output stage — only the files needed for `npm install -g`
FROM scratch
COPY --from=builder /build/package.json /package.json
COPY --from=builder /build/package-lock.json /package-lock.json
COPY --from=builder /build/dist/ /dist/
COPY --from=builder /build/packages/ /packages/
COPY --from=builder /build/node_modules/ /node_modules/