This document explains how to build and run the Epitrello application using Docker.
- Docker >= 20.10
- Docker Compose >= 2.0
Epitrello/
├── docker-compose.yml # Main orchestration file
├── backend/
│ ├── Dockerfile # Backend container definition
│ └── .dockerignore # Files to exclude from build
└── frontend/
├── Dockerfile # Frontend container definition
└── .dockerignore # Files to exclude from build
Copy the example environment file and configure it:
cp .env.example .envEdit .env with your configuration values.
From the root directory:
docker-compose up -d --buildThis will:
- Build the backend image
- Build the frontend image
- Start PostgreSQL database
- Start backend service
- Start frontend service
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f backend
docker-compose logs -f frontend
docker-compose logs -f postgresdocker-compose downdocker-compose down -v- Port: Configured via
POSTGRES_PORTin.env - Database: Configured via
POSTGRES_DBin.env - User: Configured via
POSTGRES_USERin.env - Password: Configured via
POSTGRES_PASSWORDin.env - Volume: postgres_data (persistent)
- Port: Configured via
PORTin.env - URL: http://localhost:${PORT}
- GraphQL: http://localhost:${PORT}/graphql
- Environment: Configured via
NODE_ENVin.env - Depends on: PostgreSQL
- Port: Configured via
FRONTEND_PORTin.env - URL: http://localhost:${FRONTEND_PORT}
- Environment: Configured via
NODE_ENVin.env - Depends on: Backend
All services use the .env file from the root directory. Create a .env file at the root of the project with the following content:
# PostgreSQL Configuration
POSTGRES_USER=username
POSTGRES_PASSWORD=password
POSTGRES_DB=dbname
POSTGRES_PORT=5432
# Database URL
# For Docker: use 'postgres' as hostname
# For local development: use 'localhost' as hostname
DATABASE_URL="postgresql://username:password@localhost:5432/dbname?schema=public"
# JWT Configuration (SENSITIVE - Change in production!)
JWT_SECRET=your-secret-key-change-in-production
JWT_EXPIRES_IN=7d
# Backend Configuration
PORT=4000
NODE_ENV=development
FRONTEND_URL=http://localhost:3000
# Frontend Configuration
FRONTEND_PORT=3000
NEXT_PUBLIC_API_URL=http://localhost:4000/graphql
# Email Configuration (Resend)
# Get your API key from https://resend.com
RESEND_API_KEY=re_your_api_key_here
EMAIL_FROM=noreply@yourdomain.comImportant:
- All variables must be defined in the
.envfile (no default values in docker-compose.yml) - The
DATABASE_URLmust usepostgresas the hostname (notlocalhost) to connect to the PostgreSQL service within Docker - For local development (outside Docker), use
localhostinstead ofpostgresin theDATABASE_URL - All sensitive information (passwords, secrets) should be in the
.envfile, never hardcoded - Copy
.env.exampleto.envand update with your values
The docker-compose.yml will:
- Load all variables from
.env(root directory) viaenv_filefor each service - Use variables directly without default values (variables must be defined)
For development, it's recommended to run services locally:
# Backend
cd backend
pnpm install
pnpm start:dev
# Frontend
cd frontend
pnpm install
pnpm dev
# Database
docker-compose up -d postgresUse Docker Compose for production:
docker-compose up -d --buildWhen starting the backend for the first time, you need to run migrations:
# Enter backend container
docker-compose exec backend sh
# Run migrations
pnpm prisma migrate deploy
# Or for development
pnpm prisma db pushCheck that PostgreSQL is healthy:
docker-compose ps postgresWait for the health check to pass before starting the backend.
If ports are already in use, modify the port values in your .env file:
POSTGRES_PORT=5433
PORT=4001
FRONTEND_PORT=3001Then restart the services:
docker-compose down
docker-compose up -d# Rebuild specific service
docker-compose build backend
docker-compose up -d backend
# Rebuild all services
docker-compose up -d --builddocker-compose ps# Backend
docker-compose exec backend sh
# Frontend
docker-compose exec frontend sh
# PostgreSQL
docker-compose exec postgres psql -U postgres -d epitrelloRemove all containers, networks, and volumes:
docker-compose down -v --rmi allScan your Docker images for security vulnerabilities:
# Using Docker Scout (recommended)
docker scout cves epitrello-backend
docker scout cves epitrello-frontend
# Using Trivy
trivy image epitrello-backend
trivy image epitrello-frontend
# Using Grype
grype epitrello-backend
grype epitrello-frontend- All sensitive data in
.envfile (never hardcoded) .envfile is in.gitignore(never committed)- Use strong passwords and secrets in production
- Regularly update dependencies
- Scan images for vulnerabilities
Regularly update dependencies to fix vulnerabilities:
# Backend
cd backend
pnpm update
pnpm audit fix
# Frontend
cd frontend
pnpm update
pnpm audit fixAfter updating dependencies, rebuild images:
docker-compose build --no-cache
docker-compose up -dFor production deployment:
- Set strong
JWT_SECRETin environment - Use production database credentials
- Configure proper CORS settings
- Set
NODE_ENV=production - Use reverse proxy (nginx) for SSL/TLS
- Configure proper logging
- Set up monitoring and health checks
- Regularly scan and update images for security vulnerabilities
- Use Docker content trust for image verification
- Implement network policies and firewall rules