Skip to content

infra: create frontend Dockerfile for Next.js application #7

Description

@snowrugar-beep

Problem Statement

docker/frontend.Dockerfile is referenced in documentation but does not exist. The Next.js frontend application has no container definition for deployment.

Evidence

  • Project tree shows docker/ directory exists but all files are missing
  • Frontend has Next.js 15 with Turbopack for dev
  • Frontend CI (frontend-build.yml) builds but does not produce a Docker image

Impact

Frontend cannot be containerized for deployment to Kubernetes or ECS.

Proposed Solution

Create a Dockerfile at docker/frontend.Dockerfile with:

  • deps stage: install node_modules
  • build stage: run next build
  • production stage: use standalone output mode

Technical Requirements

  • Must use Node.js 20 as base
  • Must enable output: 'standalone' in next.config.ts for minimal production image
  • Must copy only standalone output to production stage
  • Must include proper caching for next.js build artifacts

Acceptance Criteria

  1. Docker build succeeds
  2. Production image is <100MB
  3. Container starts and serves the Next.js app on port 3000
  4. Standalone output mode is enabled
  5. Health check configured

File Inventory

  • docker/frontend.Dockerfile (new)

Dependencies

None.

Testing Strategy

  • Build image and verify it starts
  • Verify all routes render correctly

Security Considerations

  • Non-root user in production
  • Minimal image size
  • Remove build-time dependencies and source maps in production

Definition of Done

  • Dockerfile created
  • Production image minimal
  • Non-root user
  • Health check configured

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions