Fix Docker configuration and add environment template

- Fix backend Dockerfile for proper development hot-reload setup
- Fix frontend Dockerfile to install dependencies at runtime
- Update pyproject.toml package configuration
- Add .env.example template (never commit actual .env)
- Properly exclude .env from version control
This commit is contained in:
Ryan Malloy 2025-09-10 01:46:28 -06:00
parent 9786b2967f
commit e54031ce6d
8 changed files with 9262 additions and 16 deletions

31
.env.example Normal file
View File

@ -0,0 +1,31 @@
# Project Configuration
COMPOSE_PROJECT=mcpmc
DOMAIN=your-domain.com
# Environment Mode
MODE=development
# Database
POSTGRES_DB=mcpmc
POSTGRES_USER=mcpmc
POSTGRES_PASSWORD=change_me_in_production
# Procrastinate Queue Database
PROCRASTINATE_DB=procrastinate
PROCRASTINATE_USER=procrastinate
PROCRASTINATE_PASSWORD=change_me_in_production
# Backend Configuration
BACKEND_HOST=0.0.0.0
BACKEND_PORT=8000
BACKEND_LOG_LEVEL=info
# Frontend Configuration
FRONTEND_HOST=0.0.0.0
FRONTEND_PORT=80
PUBLIC_DOMAIN=your-domain.com
PUBLIC_API_URL=https://api.your-domain.com
# MCP Configuration
MCP_SERVER_NAME=mcpmc-expert-system
MCP_SERVER_VERSION=1.0.0

5
.gitignore vendored
View File

@ -26,9 +26,12 @@ wheels/
*.egg
MANIFEST
# Virtual environments
# Environment files
.env
.env.local
.env.production
# Virtual environments
.venv/
env/
venv/

View File

@ -10,28 +10,28 @@ WORKDIR /app
FROM base AS builder
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
COPY pyproject.toml uv.lock* ./
COPY pyproject.toml ./
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-install-project --no-editable
uv sync --no-install-project --no-editable
COPY . .
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-editable
uv sync --no-editable
# Development target
FROM base AS development
COPY --from=builder --chown=app:app /app /app
RUN groupadd --gid 1000 app \
&& useradd --uid 1000 --gid app --shell /bin/bash --create-home app
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
USER app
EXPOSE 8000
CMD ["/app/.venv/bin/uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
CMD ["/bin/sh", "-c", "if [ ! -d .venv ]; then uv sync; fi && uv run uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload"]
# Production target
FROM base AS production
@ -53,7 +53,7 @@ CMD ["/app/.venv/bin/uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8
# Worker development target
FROM development AS worker-development
CMD ["/app/.venv/bin/python", "-m", "src.services.procrastinate_hot_reload"]
CMD ["/bin/sh", "-c", "if [ ! -d .venv ]; then uv sync; fi && uv run python -m src.services.procrastinate_hot_reload"]
# Worker production target
FROM production AS worker-production

View File

@ -5,7 +5,6 @@ description = "MCP Expert System Backend"
authors = [
{name = "MCPMC Team"}
]
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"fastapi==0.116.1",
@ -36,6 +35,9 @@ dev = [
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src"]
[tool.ruff]
line-length = 88
target-version = "py313"

1609
src/backend/uv.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,13 +6,9 @@ COPY package*.json ./
FROM base AS development
RUN npm install
COPY . .
EXPOSE 80
CMD ["npm", "run", "dev"]
CMD ["sh", "-c", "if [ ! -d node_modules ]; then npm install; fi && npm run dev"]
FROM base AS builder

7608
src/frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

1
src/frontend/src/env.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference path="../.astro/types.d.ts" />