From 83d8c4e865b03cf066585f37c9d015cbd8060063 Mon Sep 17 00:00:00 2001 From: maziggy Date: Tue, 9 Dec 2025 17:06:54 +0000 Subject: [PATCH] Added Docker support --- .dockerignore | 53 ++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 37 ++++++++++++++++++++++++++++++++ docker-compose.yml | 16 ++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..ad60d0775 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,53 @@ +# Git +.git +.gitignore + +# Python +__pycache__ +*.py[cod] +*$py.class +*.so +.Python +venv/ +.venv/ +ENV/ +env/ +.env +*.egg-info/ +.eggs/ +dist/ +build/ + +# Node +frontend/node_modules/ +frontend/.npm + +# IDE +.idea/ +.vscode/ +*.swp +*.swo + +# Testing +.pytest_cache/ +.coverage +htmlcov/ + +# Logs and data (will be mounted as volumes) +logs/ +data/ +*.log +*.db + +# Build artifacts +static/ + +# Documentation +docs/ +*.md +!requirements.txt + +# Docker +Dockerfile +docker-compose*.yml +.dockerignore diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..2348cb3f3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +# Build frontend +FROM node:22-alpine AS frontend-builder + +WORKDIR /app/frontend + +COPY frontend/package*.json ./ +RUN npm ci + +COPY frontend/ ./ +RUN npm run build + +# Production image +FROM python:3.13-slim + +WORKDIR /app + +# Install dependencies +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +# Copy backend +COPY backend/ ./backend/ + +# Copy built frontend from builder stage +COPY --from=frontend-builder /app/static ./static + +# Create data directory for persistent storage +RUN mkdir -p /app/data /app/logs + +# Environment variables +ENV PYTHONUNBUFFERED=1 +ENV DATA_DIR=/app/data + +EXPOSE 8000 + +# Run the application +CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..fd01379d2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +services: + bambuddy: + build: . + container_name: bambuddy + ports: + - "8000:8000" + volumes: + - bambuddy_data:/app/data + - bambuddy_logs:/app/logs + environment: + - TZ=Europe/Berlin + restart: unless-stopped + +volumes: + bambuddy_data: + bambuddy_logs: