Repository navigation
Expand file tree
/
Copy pathDockerfile.tests
More file actions
65 lines (48 loc) · 1.8 KB
/
Copy pathDockerfile.tests
File metadata and controls
65 lines (48 loc) · 1.8 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# ================================
# STAGE 0: Setup Base Image
# ================================
FROM node:22.20-bullseye-slim AS base
# Install pnpm globally
RUN npm install -g pnpm@latest
# Set working directory
WORKDIR /app
# Enable pnpm
RUN corepack enable pnpm
# ================================
# STAGE 1: Install Dependencies
# ================================
FROM base AS deps
# Copy workspace configuration files
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
# Copy all package.json files for dependency resolution
COPY packages/js/package.json ./packages/js/
COPY packages/node/package.json ./packages/node/
COPY packages/react/package.json ./packages/react/
COPY packages/solid/package.json ./packages/solid/
COPY packages/tsconfig/package.json ./packages/tsconfig/
# Copy example package.json files
COPY examples/todo-server-tests/package.json ./examples/todo-server-tests/
# Install all dependencies
RUN pnpm install --frozen-lockfile
# ================================
# STAGE 2: Build Packages/Examples
# ================================
FROM base AS builder
# Copy the ENTIRE dependency layer including all node_modules
COPY --from=deps /app ./
# Copy all source code (this will overlay the existing structure)
COPY packages/ ./packages/
COPY examples/ ./examples/
# Build all packages (this recreates the original compile behavior)
RUN pnpm run build:packages
RUN pnpm --filter './examples/todo-server-tests' run build
# ================================
# STAGE 3: Run Tests
# ================================
FROM base AS runtime
COPY --from=builder /app/node_modules/.pnpm ./node_modules/.pnpm
COPY --from=builder /app/packages ./packages
COPY --from=builder /app/examples/todo-server-tests ./examples/todo-server-tests
WORKDIR /app/examples/todo-server-tests
EXPOSE 8099
CMD ["pnpm", "run", "test"]