Skip to main content

Overview

Gridfinity Builder includes Docker support for consistent development environments across different platforms. The Docker setup uses Docker Compose for easy orchestration.

Prerequisites

  • Docker 20.10+
  • Docker Compose 2.0+ (included with Docker Desktop)

Quick Start

1

Build the Docker image

Build the image with no cache to ensure fresh dependencies:
This will:
  • Use Node.js 20 Alpine base image
  • Install npm dependencies
  • Copy source files
  • Configure the development server
2

Start the container

Start the application in detached mode:
The -d flag runs the container in the background.
3

Access the application

Open your browser and navigate to:

Dockerfile

The Dockerfile uses a multi-stage approach optimized for development:
Key features:
  • Alpine Linux - Minimal image size (~150MB vs 1GB+)
  • Layer caching - Package files copied separately for faster rebuilds
  • Host binding - --host 0.0.0.0 allows external connections
  • Port 5173 - Vite’s default development port

Docker Compose Configuration

The docker-compose.yml orchestrates the development environment:

Port Mappings

Volume Mounts

The following directories are mounted for hot reload:
  • ./src - Application source code
  • ./public - Static assets (icons, etc.)
  • index.html - Entry HTML file
  • vite.config.ts - Vite configuration
  • tailwind.config.ts - Tailwind CSS config
  • tsconfig.json - TypeScript configuration
Volume mounts enable hot module replacement (HMR). Changes to mounted files are immediately reflected in the running container.

Common Commands

View logs

Restart the container

Stop the container

Rebuild and restart

Execute commands inside container

Troubleshooting

Check container logs for errors:
Common issues:
  • Port 5173 already in use on host
  • npm install failed (check network/registry)
  • Missing package-lock.json
If file changes aren’t reflected:
  1. Check volume mounts:
  2. Verify file polling is enabled: The vite.config.ts includes usePolling: true for Docker compatibility.
  3. Restart the container:
If port 5173 is occupied:
Access the app at http://localhost:3000.
Files created by the container may have root ownership:
Or add to docker-compose.yml:
If npm install times out:
Ensure the container has sufficient memory:

Production Build in Docker

To build a production-ready image:

Next Steps

Local Setup

Set up without Docker for faster iteration

Building for Production

Create optimized production builds