Skip to content

7.71 Update Dockerfile for TypeScript Build #178

@flyblackbox

Description

@flyblackbox

7.71 Update Dockerfile for TypeScript Build

Summary

Update the backend Dockerfile to build and run the TypeScript-based backend. Ensure the image compiles TypeScript, runs Prisma migrations if needed, and starts the compiled Node server in a production-appropriate environment.

Tasks

  • Review the migration roadmap for Docker and build requirements
  • Update Dockerfile base image to a supported Node LTS version
  • Configure build stage:
    - Set working directory
    - Copy package.json, pnpm-lock.yaml, and pnpm config
    - Install dependencies with pnpm install --frozen-lockfile
    - Copy source files (app/, prisma/, tsconfig.json, etc.)
    - Run TypeScript build (pnpm build or npx tsc)
  • Configure runtime stage:
    - Copy compiled output (e.g., dist/) and minimal runtime dependencies
    - Copy prisma artifacts if required (e.g., node_modules/.prisma)
    - Set environment variables and NODE_ENV=production
    - Set CMD to run compiled server entrypoint (e.g., node dist/app/server.js)
  • Ensure Dockerfile uses .dockerignore to exclude unnecessary files (node_modules, tests, local artifacts)
  • If using Prisma:
    - Optionally run prisma migrate deploy or prisma generate in the image or entry script
  • Build and run the image locally for verification
  • Commit Dockerfile changes

Expected Behavior

The Docker image builds the TypeScript backend, runs the compiled server, and supports Prisma and other runtime dependencies in a production context.

Tech Notes

  • Prefer a multi-stage Docker build to keep the runtime image small.
  • Align Docker build commands with package.json scripts used for local builds.

Acceptance Criteria

  • docker build for the backend image completes successfully
  • Running the container starts the compiled server and serves GraphQL/HTTP endpoints
  • Container logs show correct startup with TypeScript build artifacts

Test Instructions

  1. Run pnpm test locally before building the image.
  2. Build the Docker image: docker build -t quote-vote-backend:ts .
  3. Run the container: docker run -p 4000:4000 quote-vote-backend:ts
  4. Hit health and GraphQL endpoints from the host to confirm behavior.
  5. Optionally, run a minimal smoke test suite inside the container or against the running container.

Labels

backend docker build typescript phase7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not Readynot ready to be assigned.🔴 BlockingThere are critical foundational tasks that must be done first.

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions