main
mula.liu 2025-12-02 21:13:52 +08:00
parent 1140cd3254
commit f3f8251f47
3 changed files with 5836 additions and 0 deletions

22
.dockerignore 100644
View File

@ -0,0 +1,22 @@
# Backend .dockerignore
__pycache__/
*.pyc
*.pyo
*.pyd
.Python
*.so
*.egg
*.egg-info
dist/
build/
*.log
.env
.env.local
.git/
.gitignore
.vscode/
.idea/
*.md
venv/
.venv/
node_modules/

37
Dockerfile 100644
View File

@ -0,0 +1,37 @@
# Backend Dockerfile for Cosmo
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
postgresql-client \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create upload directory
RUN mkdir -p /app/upload /app/logs
# Set Python path
ENV PYTHONPATH=/app
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Run the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]

5777
scripts/init_db.sql 100644

File diff suppressed because one or more lines are too long