# Build stage
FROM node:14-slim AS builder
WORKDIR /workspace
# Install system dependencies
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install PNPM (as per blueprint, version 7.9.5)
RUN npm i -g pnpm@7.9.5
# Copy the repository
COPY . .
# Install dependencies for the monorepo and build the library
RUN pnpm i --frozen-lockfile --filter "wujie-project" --filter "./packages/**"
# Build library output
RUN pnpm -w run lib
# Final runtime image
FROM node:14-slim
WORKDIR /app
# Copy built artifacts from builder
COPY --from=builder /workspace/lib ./lib
COPY --from=builder /workspace/esm ./esm
# Default command to indicate successful build
CMD ["node", "-e", "console.log('wujie-core build complete')"]
# Build stage
FROM node:14-slim AS builder
WORKDIR /workspace
# Install system dependencies
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install PNPM (as per blueprint, version 7.9.5)
RUN npm i -g pnpm@7.9.5
# Copy the repository
COPY . .
# Install dependencies for the monorepo and build the library
RUN pnpm i --frozen-lockfile --filter "wujie-project" --filter "./packages/**"
# Build library output
RUN pnpm -w run lib
# Final runtime image
FROM node:14-slim
WORKDIR /app
# Copy built artifacts from builder
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Default command to verify the container loads the library
CMD ["node", "-e", "require('./lib/index.js'); console.log('wujie-core loaded')"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Node & PNPM related node_modules/ pnpm-lock.yaml **/node_modules/ # Build outputs lib/ dist/ essm/ # OS / IDE .DS_Store .thumbs.db .idea/ .vscode/ # Git and logs .git/ .github/ *.log # Docs / examples to reduce context size docs/ examples/
# Node & PNPM related node_modules/ pnpm-lock.yaml **/node_modules/ # Build outputs lib/ dist/ essm/ # OS / IDE .DS_Store .thumbs.db .idea/ .vscode/ # Git and logs .git/ .github/ *.log # Docs / examples to reduce context size docs/ examples/
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Build stage
FROM node:slim AS builder
WORKDIR /workspace
# Install system dependencies
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install PNPM (as per blueprint, version 7.9.5)
RUN npm i -g pnpm@7.9.5
# Copy the repository
COPY . .
# Install dependencies for the monorepo and build the library
RUN pnpm i --frozen-lockfile --filter "wujie-project" --filter "./packages/**"
# Build library output
RUN pnpm -w run lib
# Final runtime image
FROM node:slim
WORKDIR /app
# Copy built artifacts from builder
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Default command to verify the container loads the library
CMD ["node", "-e", "require('./lib/index.js'); console.log('wujie-core loaded')"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Build stage
FROM node:14-slim AS builder
WORKDIR /workspace
# Install system dependencies
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install PNPM (as per blueprint, version 7.9.5)
RUN npm i -g pnpm@7.9.5
# Copy manifest files first to leverage caching
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
# Install dependencies for the monorepo and build the library
RUN pnpm i --frozen-lockfile --filter "wujie-project" --filter "./packages/**"
# Copy the rest of the repository
COPY . .
# Build library output
RUN pnpm -w run lib
# Final runtime image
FROM node:14-slim
WORKDIR /app
# Copy built artifacts from builder
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Optional: expose a simple startup message
CMD ["node", "-e", "require('./lib/index.js'); console.log('wujie-core loaded')"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Build stage
FROM node:14-slim AS builder
WORKDIR /workspace
# Install system dependencies
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install PNPM (as per blueprint, version 7.9.5)
RUN npm i -g pnpm@7.9.5
# Copy manifest files first to leverage caching
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
# Install dependencies for the monorepo and build the library
RUN pnpm i --frozen-lockfile --filter "wujie-project" --filter "./packages/**"
# Copy the rest of the repository
COPY . .
# Build library output
RUN pnpm -w run lib
# Final runtime image
FROM node:14-slim
WORKDIR /app
# Copy built artifacts from builder
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Healthcheck to ensure runtime loads
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s CMD node -e "require('./lib/index.js'); console.log('wujie-core healthy')" || exit 1
# Default command to verify the container loads the library
CMD ["node", "-e", "require('./lib/index.js'); console.log('wujie-core loaded')"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Multi-stage build for wujie monorepo
# Stage 1: builder
FROM node:18-slim AS builder
# Install system dependencies needed for build
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install pnpm (version aligned with CI workflow in repo)
RUN npm i -g pnpm@7.9.5
WORKDIR /workspace
# Install dependencies for the workspace using filters specified in blueprint
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
RUN pnpm i --frozen-lockfile --filter \"wujie-project\" --filter \"./packages/**\"
# Copy the rest of the repository and build
COPY . .
RUN pnpm -w run lib
# Stage 2: runtime image
FROM node:18-slim
WORKDIR /app
# Copy built artifacts from builder
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Simple runtime entry: validate library can be loaded
CMD ["node", "-e", "const wujie = require('./lib/index.js'); console.log('Wujie library loaded:', typeof wujie);"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Multi-stage build for wujie monorepo
# Stage 1: builder
FROM node:14-slim AS builder
# Install system dependencies needed for build
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install pnpm (version aligned with CI workflow in repo)
RUN npm i -g pnpm@7.9.5
WORKDIR /workspace
# Install dependencies for the workspace using filters specified in blueprint
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
RUN pnpm i --frozen-lockfile --filter \"wujie-project\" --filter \"./packages/**\"
# Copy the rest of the repository and build
COPY . .
RUN pnpm -w run lib
# Stage 2: runtime image
FROM node:14-slim
WORKDIR /app
# Copy built artifacts from builder
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Simple runtime entry: validate library can be loaded
CMD ["node", "-e", "const wujie = require('./lib/index.js'); console.log('Wujie library loaded:', typeof wujie);"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Multi-stage build for wujie monorepo
# Stage 1: builder
FROM node:14-slim AS builder
# Install system dependencies needed for build
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install pnpm (version aligned with CI workflow in repo)
RUN npm i -g pnpm@7.9.5
WORKDIR /workspace
# Install dependencies for the workspace using filters specified in blueprint
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
RUN pnpm i --frozen-lockfile --filter \"wujie-project\" --filter \"./packages/**\"
# Copy the rest of the repository and build
COPY . .
RUN pnpm -w run lib
# Stage 2: runtime image
FROM node:14-slim
WORKDIR /app
# Copy built artifacts from builder
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Simple runtime entry: validate library can be loaded
CMD ["node", "-e", "const wujie = require('./lib/index.js'); console.log('Wujie library loaded:', typeof wujie);"]
Concerns: RUN pnpm i --frozen-lockfile --filter \"wujie-project\" --filter \"./packages/**\" uses escaped quotes which may be passed literally to pnpm, likely breaking the workspace filter and causing build failures., COPY . . during the build stage may bring in unnecessary files (e.g., VCS data or large dev files). Not a fatal issue, but could be optimized.
Actionable info extracted:
Core packages
- wujie
- wujie-vue2
- wujie-vue3
- wujie-react
Direct start
- npm install wujie -S
- startApp({ name: "唯一id", url: "子应用路径", el: "容器", sync: true });
Vue integration
- Vue2:
- npm i wujie-vue2 -S
- import WujieVue from "wujie-vue2"; Vue.use(WujieVue);
- Vue3:
- npm i wujie-vue3 -S
- import WujieVue from "wujie-vue3"; app.use(WujieVue);
Vue usage example (component)
- <WujieVue
width="100%"
height="100%"
name="xxx"
:url="xxx"
:sync="true"
:fetch="fetch"
:props="props"
:beforeLoad="beforeLoad"
:beforeMount="beforeMount"
:afterMount="afterMount"
:beforeUnmount="beforeUnmount"
:afterUnmount="afterUnmount"
></WujieVue>
React integration
- npm i wujie-react -S
- import WujieReact from "wujie-react";
React usage example
- <WujieReact
width="100%"
height="100%"
name="xxx"
url="{xxx}"
sync="{true}"
fetch="{fetch}"
props="{props}"
beforeLoad="{beforeLoad}"
beforeMount="{beforeMount}"
afterMount="{afterMount}"
beforeUnmount="{beforeUnmount}"
afterUnmount="{afterUnmount}"
></WujieReact>
本地开发
- nvm use v14.20.0 // 切换node版本到14版本,因为有些demo的node版本比较低
- pnpm i
- npm run start
额外说明
- 目标 Node 版本要求:14.x(示例中使用 v14.20.0)# Multi-stage build for wujie monorepo
# Stage 1: builder
FROM node:slim AS builder
# Install system dependencies needed for build
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install pnpm (version aligned with CI workflow in repo)
RUN npm i -g pnpm@7.9.5
WORKDIR /workspace
# Install dependencies for the workspace using filters
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
RUN pnpm i --frozen-lockfile --filter "wujie-project" --filter "./packages/**"
# Copy the rest of the repository
COPY . .
# Build the library
RUN pnpm -w run lib
# Stage 2: runtime image
FROM node:slim
WORKDIR /app
# Copy built artifacts from builder
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Validate at runtime that the library can be loaded
CMD ["node", "-e", "const wujie = require('./lib/index.js'); console.log('Wujie library loaded:', typeof wujie);"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Multi-stage build for wujie monorepo
# Stage 1: builder
FROM node:14-slim AS builder
# Install system dependencies needed for build
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install pnpm (version aligned with CI workflow in repo)
RUN npm i -g pnpm@7.9.5
WORKDIR /workspace
# Install dependencies for the workspace using filters
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
RUN pnpm i --frozen-lockfile --filter wujie-project --filter "./packages/**"
# Copy the rest of the repository
COPY . .
# Build the library
RUN pnpm -w run lib
# Stage 2: runtime image
FROM node:14-slim
WORKDIR /app
# Copy built artifacts from builder
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Validate at runtime that the library can be loaded
CMD ["node", "-e", "const wujie = require('./lib/index.js'); console.log('Wujie library loaded:', typeof wujie);"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Multi-stage build for wujie monorepo
# Stage 1: builder
FROM node:14-slim AS builder
# Install system dependencies needed for build
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install pnpm (version aligned with CI workflow in repo)
RUN npm i -g pnpm@7.9.5
WORKDIR /workspace
# Install dependencies for the workspace using filters
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
RUN pnpm i --frozen-lockfile --filter wujie-project --filter "./packages/**"
# Copy the rest of the repository
COPY . .
# Build the library
RUN pnpm -w run lib
# Stage 2: runtime image
FROM node:14-slim
WORKDIR /app
# Copy built artifacts from builder
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Validate at runtime that the library can be loaded
CMD ["node", "-e", "const wujie = require('./lib/index.js'); console.log('Wujie library loaded:', typeof wujie);"]
# Docker build context ignores node_modules **/node_modules dist build lib esm coverage .vscode .idea .DS_Store pnpm-lock.yaml pnpm-debug.log *.log *.tmp *.temp
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
FROM node:slim AS builder # System dependencies for building native modules RUN apt-get update \ && apt-get install -y --no-install-recommends git ca-certificates python3 make g++ \ && rm -rf /var/lib/apt/lists/* # PNPM installation aligned with CI workflow RUN npm i -g pnpm@7.9.5 WORKDIR /workspace # Copy manifest files first to leverage build cache where possible COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./ # Install workspace dependencies with the specified filters RUN pnpm i --frozen-lockfile --filter wujie-project --filter ./packages/** # Copy the rest of the source code COPY . . # Build the library output RUN pnpm -w run lib # --- Runtime stage --- FROM node:slim # Minimal system deps for runtime RUN apt-get update \ && apt-get install -y --no-install-recommends ca-certificates \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Copy built artifacts from the builder stage COPY --from=builder /workspace/packages/wujie-core/lib /app/lib COPY --from=builder /workspace/packages/wujie-core/esm /app/esm # Install a tiny static file server to expose artifacts RUN npm i -g http-server@latest EXPOSE 8080 CMD ["http-server", "/app", "-p", "8080"]
node_modules **/node_modules dist lib esm coverage *.log .git .dockerignore
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
node_modules **/node_modules # Build outputs lib esm dist coverage *.log .git .dockerignore
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
FROM node:18-bullseye AS builder # System dependencies for building native modules RUN apt-get update \ && apt-get install -y --no-install-recommends git ca-certificates python3 make g++ \ && rm -rf /var/lib/apt/lists/* # PNPM installation aligned with CI workflow RUN npm i -g pnpm@7.9.5 WORKDIR /workspace # Copy manifest files first to leverage build cache where possible COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./ # Install workspace dependencies with the specified filters RUN pnpm i --frozen-lockfile --filter wujie-project --filter ./packages/** # Copy the rest of the source code COPY . . # Build the library output RUN pnpm -w run lib # --- Runtime stage --- FROM node:18-bullseye-slim AS runtime # Minimal system deps for runtime RUN apt-get update \ && apt-get install -y --no-install-recommends ca-certificates \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Copy built artifacts from the builder stage COPY --from=builder /workspace/packages/wujie-core/lib /app/lib COPY --from=builder /workspace/packages/wujie-core/esm /app/esm # Install a tiny static file server to expose artifacts RUN npm i -g http-server@1.4.0 EXPOSE 8080 CMD ["http-server", "/app", "-p", "8080"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock