This document provides instructions for setting up and using Docker for both development and production environments for the Feldspar project.
The development setup uses Dockerfile.dev and docker-compose.dev.yml to create a container with all necessary dependencies while allowing for live code reloading.
docker-compose -f docker-compose.dev.yml up --buildThis will:
- Build the Docker image with Node.js, Python, and all required dependencies
- Mount your local codebase into the container
- Start the development servers with hot reloading
- Make the application available on the following ports:
- Feldspar: http://localhost:3000
- Data Collector: http://localhost:3001
To run commands inside the running container:
docker-compose -f docker-compose.dev.yml exec feldspar-dev bashThis gives you a shell inside the container where you can run pnpm commands, tests, etc.
docker-compose -f docker-compose.dev.yml downThe production setup uses Dockerfile and docker-compose.yml to create an optimized, production-ready container.
docker-compose up --buildThis will:
- Build the Docker image with an optimized multi-stage build
- Create an optimized production build of the application
- Make the application available at http://localhost:3000
docker-compose downThe development setup uses Docker volumes to store:
- Node module dependencies
- Poetry cache
This prevents having to reinstall dependencies on every build and keeps your host machine clean.
If you encounter port conflicts, edit the port mappings in the docker-compose files:
ports:
- "NEW_HOST_PORT:CONTAINER_PORT"If you encounter problems with node modules, you might need to clear the volumes:
docker-compose -f docker-compose.dev.yml down -vThis will remove the volumes, and dependencies will be reinstalled on the next build.