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
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
Start the container
Start the application in detached mode:The
-d flag runs the container in the background.Dockerfile
The Dockerfile uses a multi-stage approach optimized for development:- Alpine Linux - Minimal image size (~150MB vs 1GB+)
- Layer caching - Package files copied separately for faster rebuilds
- Host binding -
--host 0.0.0.0allows external connections - Port 5173 - Vite’s default development port
Docker Compose Configuration
Thedocker-compose.yml orchestrates the development environment:
Port Mappings
| Host Port | Container Port | Purpose |
|---|---|---|
| 5173 | 5173 | Vite development server |
Volume Mounts
The following directories are mounted for hot reload:./src- Application source code./public- Static assets (icons, etc.)index.html- Entry HTML filevite.config.ts- Vite configurationtailwind.config.ts- Tailwind CSS configtsconfig.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
Container fails to start
Container fails to start
Check container logs for errors:Common issues:
- Port 5173 already in use on host
- npm install failed (check network/registry)
- Missing
package-lock.json
Hot reload not working
Hot reload not working
If file changes aren’t reflected:
-
Check volume mounts:
-
Verify file polling is enabled:
The
vite.config.tsincludesusePolling: truefor Docker compatibility. -
Restart the container:
Port already in use
Port already in use
If port 5173 is occupied:Access the app at
http://localhost:3000.Permission issues on Linux
Permission issues on Linux
Files created by the container may have root ownership:Or add to
docker-compose.yml:Build fails with network errors
Build fails with network errors
If npm install times out:
WASM module fails to load
WASM module fails to load
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
