Skip to content

Conversation

@ronakmaheshwari
Copy link


PR: Add Docker-based Development & Production Environment Setup

Overview

This PR introduces a complete Docker environment for local development and production, allowing contributors to easily set up and run the project without manual dependency configuration.

It resolves Issue #51 – “Docker Environment for contribution” by providing:

  • Dockerfile.dev → development with live reload (nodemon + ts-node)

  • Dockerfile → production-ready image build

  • docker-compose.dev.yml → quick developer setup

  • docker-compose.prod.yml (optional, for deployment)

  • .env.example and environment variable support

  • TypeScript & Express type fixes

  • Updated package.json scripts (build/start/dev)


Changes

File Description
server/Dockerfile.dev Dev container using nodemon and ts-node
server/Dockerfile Production Docker image using tsc build
server/docker-compose.dev.yml Dev setup with live reload & volume mounts
server/docker-compose.prod.yml (Optional) Production compose
server/.env.example Example environment file
server/tsconfig.json Added skipLibCheck to resolve Express type mismatch
server/package.json Added dev, start, and updated build scripts

Benefits

Simplifies onboarding for new contributors
Ensures consistent development environment
Supports live code updates with nodemon
Clean separation between development & production
Compatible with existing project structure & configuration
Prevents TypeScript infinite build loop and Express type errors


Installation & Usage

1. Development Environment

cd server
cp .env.example .env
docker compose -f docker-compose.dev.yml up --build

Then open:

Live reload is enabled via nodemon.


2. Production Build

docker compose -f docker-compose.prod.yml up --build -d

OR manual build:

docker build -t supercookie-prod -f Dockerfile .
docker run -p 10080:10080 -p 10081:10081 supercookie-prod

TypeScript build

npm run build

Run normally

npm run start

Notes

  • Uses Node 20 Alpine (recommended LTS instead of Node 22)

  • skipLibCheck added to avoid breaking Express typings

  • Volume mounting prevents conflicts between host and container node_modules

  • Supports both .env and .env.localhost


Checklist


Related Issue

Closes #51

Screenshot 2025-11-22 at 10 02 47 Screenshot 2025-11-22 at 10 02 41 Screenshot 2025-11-22 at 09 59 17 Screenshot 2025-11-22 at 09 58 41 Screenshot 2025-11-22 at 09 56 37

@jonasstrehle
Copy link
Owner

Thanks for your contribution, looks good to me so far, I will double check and merge later this week.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants