Skip to content

DevOps: Dockerfile Configuration Issues and Deployment Improvements #64

Description

@purvanshjoshi

Description

The Dockerfile has several configuration issues that affect deployment and security:

  1. Node.js Version Mismatch:

    • Comment says 'Install Node.js v22' but installs v20
    • Inconsistent with package.json requirements
  2. Security Concerns:

    • Running as root user
    • No health checks defined
    • No resource limits
  3. Build Optimization:

    • No multi-stage build optimization for dependencies
    • No layer caching for npm packages
    • No .dockerignore optimization

Proposed Fix

  1. 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/*
`

  1. 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
`

  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
`

  1. Add .dockerignore improvements:
    node_modules .next out venv __pycache__ .env .env.* .git .github *.md

Acceptance Criteria

  1. Node.js version matches package.json requirements
  2. Container runs as non-root user
  3. Health checks are implemented
  4. Build is optimized for layer caching
  5. .dockerignore is properly configured
  6. No emojis in any codebase changes or commits

Impact

MEDIUM - These issues affect:

  • Deployment reliability
  • Security posture
  • Build performance
  • Container resource usage

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions