DevAI Tools - Docker Deployment
Describes a Docker-ready React/TypeScript frontend for AI text and image generation with placeholder API endpoints.
What this file does
Describes a Docker-ready React/TypeScript frontend for AI text and image generation with placeholder API endpoints.
When to use it
- You need a lightweight AI frontend deployable via Docker
- You want a reference for multi-stage Docker builds with NGINX
- You are building a chat and image generation UI with React
- You need a project structure with clear API integration points
Assumes this stack
DevAI Tools - Docker Deployment
A lightweight, developer-focused frontend web application for AI text and image generation.
Features
- Text Chat: Interactive chat interface for AI-powered text generation
- Image Generation: Create AI images from text prompts
- Lightweight: No heavy UI frameworks, custom CSS only
- Responsive: Mobile-friendly design
- Docker Ready: Optimized for containerized deployment
Quick Start
Using Docker
# Build and start the application
docker-compose up --build
# Access the app at http://localhost
Development
Local Development
# Install dependencies
npm install
# Start development server
npm run dev
# Access the app at http://localhost:8080
Production Build
# Build for production
npm run build
# Preview production build
npm run preview
API Integration
The app is configured to work with these placeholder endpoints that you can replace with your actual AI service URLs:
Text Generation
# Replace https://api.example.com/text with your actual endpoint
POST https://api.example.com/text
Content-Type: application/json
{
"message": "Your text prompt here"
}
Response:
{
"response": "Generated text response"
}
Image Generation
# Replace https://api.example.com/image with your actual endpoint
POST https://api.example.com/image
Content-Type: application/json
{
"prompt": "Your image prompt here"
}
Response:
{
"image_url": "https://your-generated-image-url.com/image.jpg"
}
Customization
Update API URLs
Replace the placeholder URLs in these files with your actual API endpoints:
- Text API:
src/pages/TextChatPage.tsx(line 33) - Image API:
src/pages/ImageGenPage.tsx(line 21)
Example API Services
You can integrate with services like:
- OpenAI GPT API for text generation
- DALL-E, Midjourney, or Stable Diffusion for images
- Your own custom AI backends
Architecture
┌─────────────────┐
│ Frontend │
│ (React/TS) │
│ Port 80 │
└─────────────────┘
│
▼
┌─────────────────┐
│ NGINX │
│ Static Files │
└─────────────────┘
Production Optimizations
- Multi-stage build: Reduces final image size
- NGINX: Efficient static file serving
- Gzip compression: Reduces bandwidth usage
- Caching headers: Improves performance
- Security headers: Basic security hardening
Technology Stack
- Frontend: React 18, TypeScript, Vite
- Routing: React Router v6
- Styling: Custom CSS (no frameworks)
- Build: Vite (fast builds)
- Server: NGINX (production)
- Container: Alpine Linux (lightweight)
File Structure
src/
├── components/
│ └── Navigation.tsx # App navigation
├── pages/
│ ├── Index.tsx # Landing page
│ ├── TextChatPage.tsx # Text chat interface
│ ├── ImageGenPage.tsx # Image generation
│ └── NotFound.tsx # 404 page
├── index.css # Custom CSS styles
└── App.tsx # Main app component
Docker files:
├── Dockerfile # Multi-stage build
├── docker-compose.yml # Frontend only setup
├── nginx.conf # NGINX configuration
└── .dockerignore # Build optimization
Deployment
Production Deployment
- Configure your API URLs in the frontend code
- Build and deploy the Docker container
- Configure your AI backend services separately
Cloud Deployment Examples
Docker Hub + VPS:
docker build -t username/devai-tools .
docker push username/devai-tools
# Deploy on your VPS
Cloud Platforms:
- AWS ECS/Fargate
- Google Cloud Run
- Azure Container Instances
- DigitalOcean App Platform
License
MIT License - feel free to use and modify as needed.
What's inside
9 sections, 6 code examples, 1 architecture diagram, 1 file tree
Change this for your project
- Replace
https://api.example.com/textwith your actual text generation endpoint - Replace
https://api.example.com/imagewith your actual image generation endpoint - Replace
username/devai-toolswith your Docker Hub username and image name
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Multi-stage Dockerfile to keep production image small
- Placeholder API endpoints in dedicated files for easy replacement
Related Documents
50-best-ai-image-prompts
Lists 50 copy-paste-ready AI image prompts across 10 categories for Midjourney, DALL-E, and Stable Diffusion.
圖片提示詞專業技能 (Image Prompt Skill)
Defines a structured Chinese-language prompt format for AI image generation, replacing an older English-only convention.
Welcome to Stable Diffusion
Introduces a gallery of Stable Diffusion images with prompts, explaining the tool's basics and showcasing example outputs across themes.
Creative Prompts
Provides six structured prompt templates for creative writing and image generation, each with pro tips and example output.