Production Builds
Learn how to build and run LibreApps Desktop in production mode for testing and deployment.
Docker-Optimized Architecture
LibreApps Desktop is configured with Next.js standalone output for optimized Docker deployments. This creates minimal, self-contained production builds that are perfect for containerized environments.
Development vs Production
| Mode | Command | Use Case |
|---|---|---|
| Development | pnpm dev | Active development with hot-reload |
| Production | ./scripts/start.sh | Testing production builds locally |
| Docker | docker run | Deployment to cloud/hosting |
Do NOT use pnpm start for production builds. It's incompatible with the standalone output configuration. Use the scripts instead.
Building for Production
Default Build
From the project root:
./scripts/build.sh
This script:
- Installs dependencies
- Runs type-checking and linting
- Builds with
output: "standalone" - Copies static assets to the standalone folder
Rebranded Build
If you've customized your app with rebranding:
./scripts/build-rebrand.sh
This applies your brand settings from rebrand/settings.md and creates an optimized production build.
Running Production Builds Locally
Default Build
./scripts/start.sh
Opens at: http://localhost:3000
Manual command:
cd build/web/full-kit
PORT=3000 node .next/standalone/server.js
Rebranded Build
./scripts/start-rebrand.sh
Opens at: http://localhost:3002
Manual command:
cd rebrand/web/full-kit
PORT=3002 node .next/standalone/server.js
Standalone Build Structure
The standalone build creates a minimal, optimized output:
.next/standalone/
├── server.js # Minimal Node.js server
├── package.json # Production dependencies only
├── node_modules/ # Minimal required packages
├── .next/ # Next.js build output
│ └── static/ # Static assets
└── public/ # Public files
This folder is self-contained and ready for deployment.
Custom Port Configuration
Override the default port using the PORT environment variable:
# Default build on port 8080
PORT=8080 ./scripts/start.sh
# Rebrand build on port 8080
PORT=8080 ./scripts/start-rebrand.sh
Docker Deployment
Building a Docker Image
Create a Dockerfile in build/web/full-kit/:
FROM node:22-alpine AS base
WORKDIR /app
# Copy standalone build
COPY .next/standalone ./
COPY .next/static ./.next/static
COPY public ./public
ENV PORT=3000
ENV NODE_ENV=production
EXPOSE 3000
CMD ["node", "server.js"]
Build and run:
cd build/web/full-kit
docker build -t LibreApps Desktop-dashboard .
docker run -p 3000:3000 LibreApps Desktop-dashboard
See AI_AGENT_BUILD_INSTRUCTIONS.md for complete Docker configuration.
Quality Checks
All production builds enforce:
- ✅ TypeScript type checking
- ✅ ESLint validation
- ✅ Prettier formatting
- ✅ Pre-commit hooks (Husky + lint-staged)
Builds will fail if quality issues are detected, ensuring consistent code standards.
Troubleshooting
Error: "next start does not work with output: standalone"
Problem: You tried to run pnpm start
Solution: Use the provided scripts:
./scripts/start.shfor default builds./scripts/start-rebrand.shfor rebranded builds
Error: "Standalone build not found"
Problem: Haven't run the build script yet
Solution: Run the build script first:
./scripts/build.sh
# or
./scripts/build-rebrand.sh
Missing Static Assets (CSS/Images)
Problem: Static files not loading
Solution: The build scripts automatically handle this. If building manually:
cp -R .next/static .next/standalone/.next/static
cp -R public .next/standalone/public
CI/CD Integration
GitHub Actions validates production builds automatically:
- name: Type Check
run: cd build/web/full-kit && pnpm exec tsc --noEmit
- name: Lint
run: cd build/web/full-kit && pnpm lint
- name: Build
run: cd build/web/full-kit && pnpm build
The CI pipeline ensures all quality gates pass before merging.
Performance Optimization
The standalone build is optimized for:
- Minimal Size: Only includes production dependencies
- Fast Startup: Pre-compiled server with minimal overhead
- Container-Ready: Perfect for Docker, Kubernetes, cloud platforms
Ready to deploy? Check the Deployment Guide for cloud platform specifics.