Overview
The Los Inmaduros Backend includes full Docker support for easy deployment. Docker automatically handles database setup, dependency installation, and migrations.Prerequisites
- Docker Desktop (includes Docker Compose)
- Your environment variables configured (see Environment Variables)
Development Setup
Quick Start
The easiest way to run the project in development mode:- Backend API: http://localhost:4000
- API Documentation: http://localhost:4000/api-docs
- PostgreSQL: localhost:5432
Development Configuration
Thedocker-compose.yml file sets up two services:
PostgreSQL Database
Backend API
What Docker Does Automatically
When you rundocker-compose up, Docker automatically:
- Sets up a PostgreSQL 14 database with health checks
- Installs all Node.js dependencies
- Generates the Prisma Client
- Runs database migrations with
prisma migrate deploy - Starts the development server with hot reload
- Mounts source code volumes for live code changes
Production Setup
For production deployments, use thedocker-compose.prod.yml file:
Production Differences
- Uses multi-stage build for smaller image size
- Installs only production dependencies (
npm ci --only=production) - No source code volumes (compiled code only)
- Optimized restart policies (
restart: always) - Environment variables from
.envfile - Runs compiled JavaScript with
npm start
Production Configuration
Dockerfile Stages
TheDockerfile uses a multi-stage build:
Stage 1: Build
Stage 2: Production
Useful Docker Commands
Starting and Stopping
Viewing Logs
Database Management
Rebuilding
Container Management
Troubleshooting
Database Connection Issues
If the backend cannot connect to the database:Port Already in Use
If port 4000 or 5432 is already in use:Volume Permissions
On Linux, if you encounter permission issues:Clean Slate
To completely reset everything:Deploying to Cloud Platforms
The Docker configuration works with most container platforms:- Render: Automatically detects Dockerfile
- Railway: Supports Docker deployments
- Fly.io: Use
fly launchwith Dockerfile - Google Cloud Run: Deploy with
gcloud run deploy - AWS ECS: Use ECR and ECS task definitions
Next Steps
Environment Variables
Configure required environment variables
Production Deployment
Deploy to production platforms
