Local Setup (Docker Compose)
Relevant source files
The following files were used as context for generating this wiki page:
The Resume Matcher project can be deployed locally using Docker Compose, which provides a streamlined and containerized environment for running the application. This method encapsulates the frontend and backend services, their dependencies, and configurations, simplifying the setup process compared to a manual installation. It is the recommended approach for users who prefer containerization.
This setup defines and manages the multi-container application, ensuring that both the Next.js frontend and the FastAPI backend run in isolated environments with persistent data storage. For more detailed instructions on manual setup, see the SETUP.md guide.
Sources: SETUP.md:120-122, README.md:144-146
Architecture Overview
The Docker Compose setup consists of two main services: frontend and backend. These services are built from their respective Dockerfiles and are orchestrated to work together.
backend: A Python FastAPI application that handles all business logic, including AI processing, resume parsing, and data storage. It runs on port 8000.frontend: A Next.js application that provides the user interface. It communicates with the backend API and runs on port 3000.resume_matcher_data: A named Docker volume used by the backend service to persist application data, such as resumes and configurations, across container restarts.
Sources: docker-compose.yml:1-33
The following diagram illustrates the high-level architecture of the Docker Compose setup.
Sources: docker-compose.yml:1-33, SETUP.md:135-141
Services
The services are defined in the docker-compose.yml file.
| Service | Build Context | Exposed Port | Internal Port | Description |
|---|---|---|---|---|
backend | ./ (with Dockerfile) | 8000 | 8000 | The FastAPI application server. |
frontend | ./ (with Dockerfile) | 3000 | 3000 | The Next.js web interface. |
Sources: docker-compose.yml:5-29
Backend Container Startup
The backend container uses a shell script, docker/start.sh, as its entry point. This script starts the FastAPI application using uvicorn.
#!/bin/bash
# docker/start.sh
# Start the FastAPI application
uvicorn app.main:app --host 0.0.0.0 --port 8000
This command ensures the backend server is accessible from outside its container within the Docker network.
Sources: docker/start.sh:1-5, docker-compose.yml:16
Usage and Commands
The application is managed using standard docker-compose commands.
| Command | Description |
|---|---|
docker-compose up -d | Builds the images (if not already built) and starts the frontend and backend containers in detached mode. |
docker-compose logs -f | Follows the log output from both running containers, useful for debugging. |
docker-compose down | Stops and removes the containers, networks, and volumes created by up. |
Sources: SETUP.md:125-131
The following sequence diagram shows the process when a user runs docker-compose up -d.
Sources: docker-compose.yml, SETUP.md:125-131
Configuration
A key difference in the Docker deployment compared to the manual setup is how configuration is handled.
- API Keys: In the Docker setup, API keys for LLM providers are not configured using
.envfiles. Instead, they must be set through the application's user interface athttp://localhost:3000/settings. - Environment Variables: The
docker-compose.ymlfile setsNODE_ENV=productionfor both services. The frontend'sNEXT_PUBLIC_API_URLis hardcoded in itsDockerfileto point to the backend service.
Sources: SETUP.md:133-134, docker-compose.yml:13,26, REPORT.md:143
Data Persistence
Application data, which includes uploaded resumes, job descriptions, and user settings, is stored using a named Docker volume called resume_matcher_data.
# docker-compose.yml:17-19
volumes:
- resume_matcher_data:/app/apps/backend/data
This configuration maps the /app/apps/backend/data directory inside the backend container to the resume_matcher_data volume on the host machine. This ensures that all data managed by the TinyDB database is preserved even if the backend container is stopped or removed.
Sources: docker-compose.yml:17-19,31-33
Health Checks
The backend service includes a health check to ensure the container is running correctly. Docker periodically runs a command inside the container to verify its status.
# docker-compose.yml:20-23
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/health"]
interval: 30s
timeout: 10s
retries: 3
The health check sends a curl request to the /api/v1/health endpoint. If the endpoint returns a non-successful HTTP status code, the container will be marked as unhealthy. This path was a critical fix, as earlier versions incorrectly pointed to /health.
Sources: docker-compose.yml:20-23, REPORT.md:46-50
Using Ollama with Docker
When running a local AI model provider like Ollama on the host machine, the backend container needs a specific URL to connect to it. Instead of localhost, the special Docker DNS name host.docker.internal must be used.
To configure Ollama:
- Navigate to the Settings page in the UI:
http://localhost:3000/settings. - Select "Ollama" as the provider.
- Set the "Ollama Server URL" to
http://host.docker.internal:11434.
This allows the backend container to communicate with the Ollama service running on the host machine.
Sources: README.md:150-151