document_adding / README-Docker.md
muhammadnoman76's picture
update
31b9617
|
raw
history blame
1.54 kB

Metsa App - Docker Setup

This repository runs the Next.js frontend and FastAPI backend together using a single container image (with docker-compose for convenience).

Prerequisites

  • Docker 24+
  • Docker Compose plugin (docker compose) or Docker Desktop
  • Make (optional; Windows users can use Git Bash or WSL)

Quick start

# Build image
make build
# Start
make up
# Tail logs
make logs
# Stop
make down

Without Make:

docker compose build
docker compose up -d
docker compose logs -f --tail=200

App URLs:

How it works

  • Multi-stage Dockerfile builds the Next.js app, then runs both the built Next app and the FastAPI server in the final runtime image.
  • A small start.sh launches the backend (Uvicorn) in background and then starts Next.js.
  • docker-compose exposes ports 3000 and 8000 and mounts metsa-backend/uploads so files persist across restarts.

Customizing

  • Frontend API base URL can be overridden via NEXT_PUBLIC_API_URL (defaults to http://localhost:8000/api/v1).
  • For production, set proper environment variables in docker-compose.yml and secure the backend settings.

Notes

  • This single-container approach is simple for development and small deployments. For production, consider separate services and a reverse proxy.
  • Ensure MongoDB is reachable by the backend. Update metsa-backend/app/config.py MONGODB_URL or use an external MongoDB service/container.