Skip to content

feat: add Docker and Docker Compose support for all services#47

Open
PranavGadge01 wants to merge 1 commit intoc2siorg:mainfrom
PranavGadge01:feat/docker-support
Open

feat: add Docker and Docker Compose support for all services#47
PranavGadge01 wants to merge 1 commit intoc2siorg:mainfrom
PranavGadge01:feat/docker-support

Conversation

@PranavGadge01
Copy link
Copy Markdown

Summary

Adds full Docker and Docker Compose support across all three LensMint
services, enabling any contributor to spin up the entire stack locally
with a single command — no manual Node.js setup, no dependency conflicts,
no environment guesswork.

Motivation

Currently, setting up LensMint locally requires:

This PR removes all of that friction and makes the project significantly
more accessible to new contributors and GSoC applicants.

Changes

Owner Portal (owner-portal/)

  • Dockerfile — multi-stage build: Node.js 18 Alpine for building the
    Vite app, then nginx Alpine to serve the static output. Keeps the final
    image small and production-appropriate.
  • nginx.conf — configures nginx to support React client-side routing
    (all routes fall back to index.html) with static asset caching.
  • .dockerignore — excludes node_modules, dist, .env files and logs.

Public Server (lensmint-public-server/)

  • Dockerfile — Node.js 18 Alpine, installs production dependencies only,
    creates the database directory, exposes port 4000.
  • .dockerignore — excludes node_modules, database files and .env.

Hardware Web3 Service (hardware-web3-service/)

  • Dockerfile — Node.js 18 Alpine, installs production dependencies only,
    creates the database directory, exposes port 5000.
  • .dockerignore — excludes node_modules, database files and .env.

Root Level

  • docker-compose.yml — orchestrates all three services on a shared
    bridge network (lensmint-network). Database files are persisted via
    named Docker volumes so data survives container restarts. All secrets
    and config are passed via environment variables at runtime — nothing
    baked into the image.
  • .env.example — single root-level template covering every environment
    variable needed across all three services, with clear comments.

Architecture

docker compose up --build
        │
        ├── owner-portal        (port 3000) — nginx serving built React app
        ├── public-server       (port 4000) — Node.js claim/QR server
        └── hardware-web3-service (port 5000) — Node.js blockchain service
                │
                └── all connected via lensmint-network bridge

Usage

# 1. Copy environment template
cp .env.example .env

# 2. Fill in your values in .env

# 3. Start everything
docker compose up --build

# Services:
# Owner Portal      → http://localhost:3000
# Public Server     → http://localhost:4000
# Web3 Service      → http://localhost:5000

# Stop everything
docker compose down

# Stop and delete volumes (clears database)
docker compose down -v

Design Decisions

  • Multi-stage build for owner-portal: The builder stage uses the full
    Node.js image to compile the Vite app. The final stage uses nginx Alpine
    (~25MB) instead of Node (~150MB), keeping the image lean.
  • Production deps only for backend services: Both Node.js services use
    npm install --production to exclude devDependencies from the image.
  • Named volumes for databases: SQLite database files are stored in
    named Docker volumes, not bind mounts, so they persist across
    docker compose down and work cross-platform without permission issues.
  • No secrets in images: All API keys, private keys and app secrets are
    injected at runtime via environment variables. The .env file is excluded
    from all images via .dockerignore.
  • Shared bridge network: All services communicate over lensmint-network
    rather than exposing inter-service calls through the host.

Testing

  • docker compose build completes without errors
  • All three containers start with docker compose up
  • Owner portal accessible at http://localhost:3000
  • Public server accessible at http://localhost:4000
  • Web3 service accessible at http://localhost:5000
  • Containers communicate via lensmint-network
  • Database persists after docker compose down and docker compose up

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.

1 participant