Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 21, 2025

This PR adds Docker support to the Unthread Webhook Server, enabling easy containerized deployment with production-ready configuration.

Changes Made

🐳 Added Dockerfile with multi-stage build

  • Build stage: Uses Node.js 20 Alpine to install dependencies and compile TypeScript
  • Production stage: Uses Node.js 20 Alpine with only production dependencies and compiled code
  • Security: Runs as non-root user (nodejs:nodejs) for enhanced security
  • Health check: Configured to monitor /health endpoint
  • Optimized: Layer caching for faster subsequent builds

📁 Added .dockerignore

  • Excludes unnecessary files from build context (node_modules, dist, .git, .env, etc.)
  • Reduces build context size and improves build performance
  • Follows Docker best practices for Node.js applications

Usage

# Build the image
docker build -t unthread-webhook-server .

# Run with required environment variables
docker run -p 3000:3000 \
  -e REDIS_URL=redis://localhost:6379 \
  -e UNTHREAD_WEBHOOK_SECRET=your_secret_here \
  unthread-webhook-server

Docker Compose Example

version: '3.8'
services:
  webhook-server:
    build: .
    ports:
      - "3000:3000"
    environment:
      - REDIS_URL=redis://redis:6379
      - UNTHREAD_WEBHOOK_SECRET=your_secret_here
    depends_on:
      - redis
  
  redis:
    image: redis:alpine
    ports:
      - "6379:6379"

Verification

  • ✅ Docker build completes successfully (~203MB final image)
  • ✅ Container starts and runs application correctly
  • ✅ Environment validation works as expected
  • ✅ Application handles Redis connection gracefully
  • ✅ Health check endpoint functional
  • ✅ No application code changes required

The containerized application maintains full compatibility with the existing codebase while providing a standardized deployment method across different environments.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@warengonzaga warengonzaga changed the base branch from main to dev June 21, 2025 09:46
Copilot AI changed the title [WIP] Add Docker support for project deployment Add Docker support for containerized deployment Jun 21, 2025
Copilot AI requested a review from warengonzaga June 21, 2025 09:56
Copilot finished work on behalf of warengonzaga June 21, 2025 09:56
@warengonzaga warengonzaga marked this pull request as ready for review June 21, 2025 09:57
Copilot AI review requested due to automatic review settings June 21, 2025 09:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces Docker support for the Unthread Webhook Server, providing a multi-stage build Dockerfile with production-ready configuration and a comprehensive .dockerignore to streamline build contexts.

  • Multi-stage Dockerfile including build and production stages, non-root user, and health check
  • .dockerignore excludes unnecessary files to reduce build context size and improve performance

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Dockerfile Added multi-stage build, non-root user setup, health check, and optimized layer caching
.dockerignore Excluded dependencies, build artifacts, documentation, and other unnecessary files from the Docker build context

Copy link
Member

@warengonzaga warengonzaga left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@warengonzaga warengonzaga left a comment

Choose a reason for hiding this comment

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

All good, I need to update some part of it but that would be a PR for dev branch not here.

@warengonzaga warengonzaga merged commit 04a6ed9 into dev Jun 21, 2025
1 check passed
@warengonzaga warengonzaga deleted the copilot/fix-3de98a26-31e5-4f11-b5a5-0c57e7f0b894 branch June 21, 2025 10:09
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