This guide explains how to build and run the landing page application in Docker for production.
- Docker Desktop installed and running
- Docker Compose (usually included with Docker Desktop)
- Windows PowerShell or Git Bash
# Build and start the container
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the container
docker-compose downThe application will be available at: http://localhost:4000
# Navigate to landing-page directory
cd landing-page
# Build the image
docker build -t shahin-landing-page:latest -f Dockerfile .
# Run the container
docker run -d -p 4000:80 --name shahin-landing shahin-landing-page:latest
# View logs
docker logs -f shahin-landing
# Stop the container
docker stop shahin-landing
docker rm shahin-landingWindows (PowerShell):
cd landing-page
.\build-production.ps1Linux/Mac (Bash):
cd landing-page
chmod +x build-production.sh
./build-production.shThe Dockerfile uses a multi-stage build:
-
Builder Stage:
- Uses Node.js 18 Alpine
- Installs dependencies
- Builds the React app using Vite
-
Production Stage:
- Uses Nginx Alpine (lightweight web server)
- Copies built files from builder stage
- Configures Nginx with optimized settings
Create a .env file in the landing-page directory if you need to customize:
VITE_API_URL=https://your-api-url.com/api
VITE_FRONTEND_URL=https://your-frontend-url.comNote: For production builds, environment variables must start with VITE_ to be included in the build.
The production build includes:
- ✅ Minified JavaScript and CSS
- ✅ Code splitting and chunk optimization
- ✅ Removed console.log statements
- ✅ Gzip compression enabled
- ✅ Static asset caching (1 year)
- ✅ SPA routing support
- ✅ Health check endpoint at
/health
After starting the container, verify it's working:
-
Health Check: http://localhost:4000/health
- Should return "healthy"
-
Application: http://localhost:4000
- Should display the landing page
-
Check Container Status:
docker ps
- Container should show "Up" status
# Check container logs
docker logs shahin-landing
# Check if port 4000 is already in use
netstat -ano | findstr :4000# Clean Docker build cache
docker builder prune
# Rebuild without cache
docker build --no-cache -t shahin-landing-page:latest -f Dockerfile .- Rebuild the image:
docker-compose build - Restart the container:
docker-compose up -d - Clear browser cache
landing-page/
├── Dockerfile # Multi-stage production Dockerfile
├── .dockerignore # Files excluded from Docker build
├── nginx.conf # Nginx configuration
├── package.json # Dependencies and scripts
├── vite.config.js # Vite build configuration (optimized)
├── build-production.ps1 # Windows build script
├── build-production.sh # Linux/Mac build script
└── ... # Source files
# Build and tag for Azure Container Registry
docker build -t <acr-name>.azurecr.io/shahin-landing:latest -f landing-page/Dockerfile ./landing-page
docker push <acr-name>.azurecr.io/shahin-landing:latest
# Update Container App
az containerapp update \
--name shahin-landing-prod \
--resource-group <resource-group> \
--image <acr-name>.azurecr.io/shahin-landing:latestThe Docker image can be deployed to:
- AWS ECS/Fargate
- Google Cloud Run
- DigitalOcean App Platform
- Any Docker-compatible platform
- Image Size: ~50-60MB (Alpine-based)
- Build Time: ~2-5 minutes (depending on system)
- Memory Usage: ~20-30MB at runtime
- Startup Time: <1 second
The production build includes:
- Security headers (XSS protection, frame options, etc.)
- Content Security Policy
- HTTPS redirect headers (for production use)
- No debug information in production builds
For issues or questions:
- Check container logs:
docker logs shahin-landing - Review build output for errors
- Verify Docker is running:
docker info
Last Updated: November 2025
Maintained by: DoganConsult