Skip to content
This repository was archived by the owner on Jun 12, 2026. It is now read-only.

Added Docker-based Development & Production Environment Setup#52

Open
ronakmaheshwari wants to merge 1 commit into
jonasstrehle:mainfrom
ronakmaheshwari:main
Open

Added Docker-based Development & Production Environment Setup#52
ronakmaheshwari wants to merge 1 commit into
jonasstrehle:mainfrom
ronakmaheshwari:main

Conversation

@ronakmaheshwari

Copy link
Copy Markdown

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
Copy Markdown
Owner

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

@ronakmaheshwari

Copy link
Copy Markdown
Author

@jonasstrehle any updates

@codeCraft-Ritik codeCraft-Ritik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opting for Node 20 Alpine is a great choice for keeping image sizes small and sticking to the LTS. However, for the production Dockerfile, are you using a multi-stage build? This would allow you to compile the TypeScript code in a "build" stage and only copy the compiled /dist and production node_modules to the final image, further reducing the attack surface and image size.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants