Description
The Dockerfile has several configuration issues that affect deployment and security:
-
Node.js Version Mismatch:
- Comment says 'Install Node.js v22' but installs v20
- Inconsistent with package.json requirements
-
Security Concerns:
- Running as root user
- No health checks defined
- No resource limits
-
Build Optimization:
- No multi-stage build optimization for dependencies
- No layer caching for npm packages
- No .dockerignore optimization
Proposed Fix
- Fix Node.js version:
`dockerfile
Install Node.js v20 (matching package.json requirements)
RUN apt-get update && apt-get install -y curl git build-essential
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
&& apt-get install -y nodejs
&& npm install -g gitnexus@latest tree-sitter-kotlin
&& rm -rf /var/lib/apt/lists/*
`
- Add security improvements:
`dockerfile
Create non-root user
RUN useradd -m -u 1000 appuser
USER appuser
Add health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3
CMD curl -f http://localhost:7860/ || exit 1
`
- Optimize build:
`dockerfile
Copy package files first for better caching
COPY dashboard/package.json dashboard/package-lock.json ./
RUN npm ci --only=production
Copy source files
COPY dashboard/ ./
RUN npm run build
`
- Add .dockerignore improvements:
node_modules .next out venv __pycache__ .env .env.* .git .github *.md
Acceptance Criteria
- Node.js version matches package.json requirements
- Container runs as non-root user
- Health checks are implemented
- Build is optimized for layer caching
- .dockerignore is properly configured
- No emojis in any codebase changes or commits
Impact
MEDIUM - These issues affect:
- Deployment reliability
- Security posture
- Build performance
- Container resource usage
Description
The Dockerfile has several configuration issues that affect deployment and security:
Node.js Version Mismatch:
Security Concerns:
Build Optimization:
Proposed Fix
`dockerfile
Install Node.js v20 (matching package.json requirements)
RUN apt-get update && apt-get install -y curl git build-essential
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
&& apt-get install -y nodejs
&& npm install -g gitnexus@latest tree-sitter-kotlin
&& rm -rf /var/lib/apt/lists/*
`
`dockerfile
Create non-root user
RUN useradd -m -u 1000 appuser
USER appuser
Add health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3
CMD curl -f http://localhost:7860/ || exit 1
`
`dockerfile
Copy package files first for better caching
COPY dashboard/package.json dashboard/package-lock.json ./
RUN npm ci --only=production
Copy source files
COPY dashboard/ ./
RUN npm run build
`
node_modules .next out venv __pycache__ .env .env.* .git .github *.mdAcceptance Criteria
Impact
MEDIUM - These issues affect: