You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2c7623d
Browse filesBrowse the repository at this point in the historyBrowse files
feat: migrate to Chainguard Wolfi OS containers and optimize build performance
- Switch Dockerfile to use Chainguard base images for enhanced security
- Implement multi-stage builds with dev and runtime stages
- Use corepack for pnpm management in containers
- Add comprehensive test scripts for different container scenarios
- Update OpenSpec documentation with completed containerization tasks
- Optimize package.json scripts for both containerized and native testing
- Enhance compose.yaml with proper Chainguard volume paths
# Change: Migrate to Chainguard Wolfi OS Containers
2
+
3
+
## Why
4
+
Migrate from Debian-based Node.js containers to Chainguard Wolfi OS containers to achieve ~90% reduction in CVEs, smaller image sizes, and automated security patching. Chainguard's distroless runtime images provide minimal attack surface while Wolfi OS offers comprehensive package management for build stages.
5
+
6
+
## What Changes
7
+
-**Base Image Migration**: Replace `node:22-bookworm-slim` with `cgr.dev/chainguard/node:latest-dev` and `cgr.dev/chainguard/node:latest`
8
+
-**Package Manager**: Replace `apt-get` with Wolfi's `apk` package manager
9
+
-**Multi-stage Optimization**: Use dev image for builds, distroless image for runtime
10
+
-**Security Hardening**: Add dumb-init for proper signal handling, leverage Chainguard's security features
11
+
-**Project Guidelines**: Update project.md to mandate Chainguard containers
# Change: Optimize Dockerfile Build Performance and Security
2
+
3
+
## Why
4
+
The current Dockerfile implements multi-stage builds but has optimization opportunities that can reduce build times by 15-25%, decrease image size by ~50MB, and improve security posture. These improvements will enhance developer productivity and CI/CD pipeline performance while maintaining the existing containerized testing workflow.
5
+
6
+
## What Changes
7
+
-**Layer Reduction**: Combine multiple COPY commands and remove redundant operations
8
+
-**Build Performance**: Add BuildKit cache mounts for apt and pnpm, pin pnpm version for reproducibility
The build system SHALL use multi-stage Dockerfile with optimized layer caching, BuildKit cache mounts, and security best practices for containerized builds.
5
+
6
+
#### Scenario: BuildKit cache mount integration
7
+
-**WHEN** building container images with BuildKit enabled
8
+
-**THEN** system SHALL use cache mounts for apt package cache
9
+
-**AND** use cache mounts for pnpm store
10
+
-**AND** reduce redundant package downloads across builds
11
+
-**AND** improve build performance by 15-25%
12
+
13
+
#### Scenario: Layer consolidation for faster builds
14
+
-**WHEN** optimizing Dockerfile layers
15
+
-**THEN** system SHALL combine related COPY commands
16
+
-**AND** remove redundant file system operations
17
+
-**AND** minimize image layer count
18
+
-**AND** improve Docker layer caching efficiency
19
+
20
+
#### Scenario: Reproducible builds with pinned dependencies
21
+
-**WHEN** building for production or CI
22
+
-**THEN** system SHALL pin pnpm to version 10.20.0
23
+
-**AND** use NODE_VERSION build arg with default of 22
24
+
-**AND** ensure consistent builds across environments
25
+
-**AND** support Node.js version flexibility when needed
26
+
27
+
#### Scenario: Security-hardened runtime image
28
+
-**WHEN** creating production runtime images
29
+
-**THEN** system SHALL remove build dependencies from final stage
30
+
-**AND** run as non-root user (node:node)
31
+
-**AND** add OCI security labels/metadata
32
+
-**AND** minimize attack surface
33
+
34
+
### Requirement: Containerized Build Support
35
+
The build system SHALL support containerized builds for environment consistency with optimized performance and security.
36
+
37
+
#### Scenario: Docker-based Linux Container Builds with BuildKit
38
+
-**WHEN** building in containerized environment
39
+
-**THEN** system SHALL use Docker for Linux container builds
40
+
-**AND** provide consistent build toolchain
41
+
-**AND** support multi-stage optimization with BuildKit features
42
+
-**AND** enable layer caching and cache mounts
43
+
-**AND** optimize for both development and CI workflows
44
+
45
+
#### Scenario: Health check configuration alignment
46
+
-**WHEN** configuring container health checks
47
+
-**THEN** system SHALL align HEALTHCHECK timeout with compose.yaml (10s)
48
+
-**AND** provide appropriate start period and retry settings
0 commit comments