Docker Installation

Deploy FastBuildAI with Docker

Environment Preparation

Server/Local configuration requirements:

  • 2 CPU cores
  • 4GB RAM
  • ≥5GB disk space

Before deploying FastBuildAI with Docker, please ensure your system has the following software installed:

You can check if they are properly installed using the following commands:

# Check Docker version
docker --version

# Check Docker Compose version
docker compose version

Deployment Steps

1. Get the Code

# Github
git clone https://github.com/FastbuildAI/FastbuildAI.git

# Gitee
git clone https://gitee.com/FastbuildAI/FastBuildAI.git

2. Configure Environment Variables

Before running Docker commands, you need to configure environment variables. Make sure the .env.production.local file exists in the project root directory. You can copy and modify it from the example file:

# Navigate to the project root directory
cd FastBuildAI

# Copy the environment variable configuration file
cp .env.production.local.example .env.production.local

Then edit the .env.production.local file according to your requirements. If you're deploying locally with no special requirements, no modifications are needed. If you need to deploy to an online environment, you'll need to configure the frontend API domain VITE_APP_BASE_URL.

The main configuration items include:

  • Database connection information
  • API keys and security settings
  • Network and port configurations

3. Start Services

After configuring the environment variables, execute the following command in the project root directory to start all services:

docker compose -p fastbuildai --env-file ./.env.production.local -f ./docker/docker-compose.yml up -d

This command will:

  • Use the -p fastbuildai parameter to specify the project name
  • Load environment variable configurations via --env-file ./.env.production.local
  • Specify the Docker Compose configuration file with -f ./docker/docker-compose.yml
  • Start all services in the background with up -d

Configuration Details

Docker Compose Configuration

The ./docker/docker-compose.yml file defines all service containers required by FastBuildAI. The default configuration can meet most use cases, but you can also customize it according to your needs.

Service Management

View Running Status

docker compose -p fastbuildai -f ./docker/docker-compose.yml ps

View Service Logs

# View logs for all services
docker compose -p fastbuildai -f ./docker/docker-compose.yml logs

# View logs for a specific service (e.g., api service)
docker compose -p fastbuildai -f ./docker/docker-compose.yml logs api

# View logs in real-time
docker compose -p fastbuildai -f ./docker/docker-compose.yml logs -f

Stop Services

docker compose -p fastbuildai -f ./docker/docker-compose.yml down

Restart Services

docker compose -p fastbuildai -f ./docker/docker-compose.yml restart

Data Persistence

FastBuildAI data is stored in Docker volumes by default, ensuring that data is not lost after container restarts. The main data volumes include:

  • Database data
  • Uploaded files and resources
  • Configuration files

Common Issues

Port Conflicts

If you encounter port conflict issues, you can modify the port configuration in the .env.production.local file and then restart the services.

Container Startup Failures

Please check:

  1. If Docker service is running properly
  2. If environment variable files are correctly configured
  3. View container logs for detailed error information:
    docker compose -p fastbuildai -f ./docker/docker-compose.yml logs

Performance Optimization

For production environments, it is recommended to adjust container resource limits according to server configuration. You can set CPU and memory limits in the docker-compose.yml file.

Upgrade Guide

When a new version is released, you can follow these steps to upgrade:

  1. Pull the latest code
  2. Stop currently running containers
  3. Start services with the new Docker Compose file
# Stop current services
docker compose -p fastbuildai -f ./docker/docker-compose.yml down

# Pull latest images
docker compose -p fastbuildai -f ./docker/docker-compose.yml pull

# Start new version services
docker compose -p fastbuildai --env-file ./.env.production.local -f ./docker/docker-compose.yml up -d