forked from jeremylongshore/claude-code-plugins-plus-skills
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.test
More file actions
94 lines (74 loc) · 2.57 KB
/
Dockerfile.test
File metadata and controls
94 lines (74 loc) · 2.57 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Multi-stage Docker test environment for claude-code-plugins
# Tests clean environment with no global pollution
# Stage 1: Node base with tools
FROM node:20-alpine AS base
LABEL maintainer="Intent Solutions IO"
LABEL description="Claude Code Plugins - Test Environment"
# Install required tools
RUN apk add --no-cache \
git \
python3 \
py3-pip \
jq \
bash \
curl \
ca-certificates
# Stage 2: Build dependencies
FROM base AS builder
WORKDIR /app
# Copy only dependency files first (for better caching)
COPY package.json pnpm-lock.yaml ./
# Install pnpm and dependencies
RUN npm install -g pnpm@9.15.9 && \
pnpm install --frozen-lockfile --no-optional
# Stage 3: Test environment
FROM builder AS test
# Copy entire project
COPY . .
# Verify git is clean
RUN git status || true
# Set environment variables for testing
ENV NODE_ENV=test
ENV CI=true
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
# Run all test suites
RUN echo "======================================" && \
echo "Building packages..." && \
echo "======================================" && \
pnpm build
RUN echo "======================================" && \
echo "Running tests..." && \
echo "======================================" && \
pnpm test || true
RUN echo "======================================" && \
echo "Running linting..." && \
echo "======================================" && \
pnpm lint || true
RUN echo "======================================" && \
echo "Running type checking..." && \
echo "======================================" && \
pnpm typecheck || true
# Run validation scripts
RUN echo "======================================" && \
echo "Running plugin validation..." && \
echo "======================================" && \
bash /app/scripts/validate-all-plugins.sh
# Stage 4: Minimal final image for production testing
FROM base AS production-test
WORKDIR /app
# Copy only built artifacts and necessary files
COPY --from=test /app/node_modules ./node_modules
COPY --from=test /app/.pnpm-store ./.pnpm-store
COPY --from=test /app/package.json pnpm-lock.yaml ./
COPY --from=test /app/plugins ./plugins
COPY --from=test /app/.claude-plugin ./.claude-plugin
COPY --from=test /app/marketplace ./marketplace
ENV NODE_ENV=production
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
# Health check for the build
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD pnpm --version || exit 1
ENTRYPOINT ["bash"]
CMD ["-c", "echo 'Test environment ready' && pnpm --version && node --version && npm --version"]