From ff0874fb5651dfe1b7779f26f5de618db86cc62b Mon Sep 17 00:00:00 2001 From: Ernest Boakye Danquah Date: Fri, 20 Feb 2026 08:11:06 -0500 Subject: [PATCH] Add Dockerfiles, docker-compose, and docs for Docker support --- .dockerignore | 11 +++++++++++ DOCKER_RUN.md | 19 +++++++++++++++++++ app/Dockerfile | 14 ++++++++++++++ backend/Dockerfile | 25 +++++++++++++++++++++++++ docker-compose.yml | 24 ++++++++++++++++++++++++ 5 files changed, 93 insertions(+) create mode 100644 .dockerignore create mode 100644 DOCKER_RUN.md create mode 100644 app/Dockerfile create mode 100644 backend/Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b414d97 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +.git +.gitignore +node_modules +dist +build +venv +__pycache__ +*.pyc +.env +*.egg-info +*.log diff --git a/DOCKER_RUN.md b/DOCKER_RUN.md new file mode 100644 index 0000000..4a74346 --- /dev/null +++ b/DOCKER_RUN.md @@ -0,0 +1,19 @@ +# Run with Docker + +Quick steps to build and run the project using Docker Compose: + +Build and start both services: + +```bash +docker-compose up --build +``` + +This will: +- Build the Python backend (exposes port 8000) +- Build the frontend and serve it via nginx (exposes port 3000 -> nginx:80) + +Backend data is persisted to a Docker volume mounted at `/data` in the container. + +Notes: +- The backend installs large ML dependencies (torch, transformers) and may result in a large image. +- You can pass a custom data directory by mounting a host folder to the `data` volume in `docker-compose.yml`. diff --git a/app/Dockerfile b/app/Dockerfile new file mode 100644 index 0000000..d6f391c --- /dev/null +++ b/app/Dockerfile @@ -0,0 +1,14 @@ +FROM node:18-alpine AS build + +WORKDIR /app + +# Install deps and build +COPY app/package.json app/package-lock.json* ./ +COPY app/ ./ +RUN npm install --legacy-peer-deps +RUN npm run build + +FROM nginx:stable-alpine +COPY --from=build /app/dist /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..089b281 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,25 @@ +FROM python:3.11-slim + +ENV PYTHONUNBUFFERED=1 + +WORKDIR /app + +# Install system deps (audio libs, ffmpeg for processing) +RUN apt-get update \ + && apt-get install -y --no-install-recommends build-essential libsndfile1 ffmpeg \ + && rm -rf /var/lib/apt/lists/* + +# Install Python deps +COPY backend/requirements.txt /app/requirements.txt +RUN pip install --upgrade pip \ + && pip install --no-cache-dir -r /app/requirements.txt + +# Copy server entrypoint and package +COPY backend/server.py /app/server.py +COPY backend /app/backend + +VOLUME ["/data"] + +EXPOSE 8000 + +CMD ["python", "server.py", "--host", "0.0.0.0", "--port", "8000", "--data-dir", "/data"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e848766 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +version: '3.8' +services: + backend: + build: + context: . + dockerfile: backend/Dockerfile + ports: + - "8000:8000" + volumes: + - data:/data + environment: + - PYTHONUNBUFFERED=1 + + frontend: + build: + context: . + dockerfile: app/Dockerfile + ports: + - "3000:80" + depends_on: + - backend + +volumes: + data: