Skip to content

[DevOps] Create Deployment Pipeline with Docker, Vercel Config, and Environment Management #26

Description

@KarenZita01

Description

The frontend has no deployment configuration. There are no Dockerfiles, no deployment scripts, no environment configuration for staging/production, and no infrastructure-as-code setup. For reliable deployments, a well-defined deployment pipeline is essential.

Deployment gaps:

  • No Dockerfile for containerized deployment
  • No docker-compose for local development with backend
  • No Vercel configuration (vercel.json)
  • No environment-specific .env files (staging, production)
  • No deployment documentation
  • No rollback procedure
  • No blue/green deployment strategy
  • No CDN configuration for static assets
  • No domain and SSL configuration guidance
  • No staging environment setup

Technical Context & Impact

  • Affected Components/Files: Dockerfile (missing), .dockerignore (missing), vercel.json (missing)
  • Impact: Cannot deploy reliably; no staging environment for testing

Step-by-Step Implementation Guide

  1. Create Vercel configuration: vercel.json:
    • Framework preset: nextjs
    • Build and install commands
    • Environment variable integration
    • Preview deployments for PRs
    • Custom domain configuration with SSL
  2. Create Dockerfile: Multi-stage build:
    • Stage 1: node:20-alpine for npm ci and npm run build
    • Stage 2: node:20-alpine slim for production with next start
    • Layer caching optimization (copy package.json before source)
    • Non-root user (node) for security
    • Health check: CMD curl -f http://localhost:3000/api/health
  3. Create docker-compose.yml: For local development:
    • Frontend service with hot reload
    • Backend API service
    • Redis for caching (optional)
    • Network configuration for inter-service communication
  4. Set up environment files:
    • .env.development - local development values
    • .env.staging - staging environment values
    • .env.production - production values
    • Validate vars before build with Zod schema
  5. Create NGINX configuration: nginx.conf for reverse proxy with:
    • Static asset caching
    • Gzip compression
    • Security headers (redundant with Next.js middleware)
    • Rate limiting on API routes
  6. Deployment documentation: docs/DEPLOYMENT.md with:
    • Prerequisites (Node version, environment variables)
    • Build steps
    • Deployment to Vercel (one-click)
    • Deployment to Docker (container)
    • Rollback procedure
    • Monitoring setup after deployment

Verification & Testing Steps

  1. Run docker build -t equipchain-frontend . -> verify build succeeds
  2. Run docker-compose up -> verify frontend accessible at localhost:3000
  3. Deploy to Vercel preview -> verify all pages render correctly
  4. Test environment-specific configuration: set NEXT_PUBLIC_ENV=staging -> verify staging API URL used
  5. Test rollback: deploy v2 -> rollback to v1 -> verify v1 works
  6. Verify NGINX config passes nginx -t

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions