Skip to main content

Overview

The Tournament Management App is fully containerized using Docker, enabling consistent deployments across development, staging, and production environments. The application uses a multi-stage Docker build to create optimized production images.

Prerequisites

Docker Engine

Version 20.10 or higher

Docker Compose

Version 2.0 or higher
Install Docker Desktop for your operating system:

Quick Start with Docker Compose

The fastest way to deploy is using Docker Compose:
1

Clone the repository

2

Build and start the container

Starts the application on http://localhost:5000 with Development environment settings.
3

Access the application

  • Development: Navigate to http://localhost:5000
  • Production: Navigate to http://localhost:80
The database is automatically initialized with the required schema during container startup.
4

Verify health

Check the application health endpoint:
You should receive a Healthy response.

Docker Compose Configuration

Development Environment

docker-compose.yml
The Development configuration enables detailed error pages, developer exception pages, and hot reload capabilities.

Production Environment

docker-compose.prod.yml
Production mode disables detailed error messages and enables performance optimizations. Always use HTTPS in production with proper SSL certificates.

Dockerfile Structure

The application uses a multi-stage build for optimal image size and security:

Stage 1: Build

Dockerfile (Build Stage)
The build stage:
  • Uses the full .NET SDK (8.0) for compilation
  • Installs Entity Framework Core tools
  • Creates a solution and adds all projects
  • Restores NuGet dependencies
  • Builds in Release configuration
  • Runs migrations for both database contexts
  • Publishes the optimized application
  • Cleans up unnecessary files to reduce image size

Stage 2: Runtime

Dockerfile (Runtime Stage)
The runtime stage:
  • Uses the lightweight ASP.NET runtime (no SDK)
  • Copies only the published application
  • Includes the pre-initialized SQLite database
  • Exposes port 80 for HTTP traffic
  • Configures the entry point for the web application

Container Management

View Running Containers

Expected output:

View Container Logs

For continuous log streaming:

Stop the Container

To remove volumes as well:

Restart the Container

Execute Commands Inside Container

Building Custom Images

If you need to customize the Docker image:

Environment Variables

You can override environment variables in docker-compose.yml:
For SQLite databases, the connection string should point to a file path. For SQL Server, use a full connection string with server, database, and credentials.

Data Persistence

The SQLite database is created inside the container at /app/Torneo.db. To persist data across container restarts, you can mount a volume:

Cloud Deployment

The application includes a render.yaml configuration for deployment to Render.com:
render.yaml

Render

One-click deployment from GitHub

Azure

Azure Container Instances

AWS

Amazon ECS or App Runner

Troubleshooting

Solution: Check container logs for errors:
Common issues:
  • Port 5000 or 80 already in use
  • Insufficient memory or disk space
  • Database migration failures
Solution: The Dockerfile runs migrations automatically during build. If the database is missing:
Solution: Ensure the container is healthy:
If unhealthy, check that the database is accessible and properly initialized.
Solution: Rebuild the image after code changes:

Next Steps

Database Setup

Learn about database configuration and migrations

Configuration

Configure environment variables and settings

Managing Teams

Start managing your tournament teams

User Authentication

Set up user accounts and permissions