Add Dockerfile for EasyPanel deployment
Some checks failed
Lint Forced User ID Patterns / lint-forced-user-id (push) Has been cancelled
Some checks failed
Lint Forced User ID Patterns / lint-forced-user-id (push) Has been cancelled
This commit is contained in:
68
.dockerignore
Normal file
68
.dockerignore
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
# Git
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
# Node modules (rebuilt inside Docker)
|
||||||
|
frontend/node_modules
|
||||||
|
|
||||||
|
# Python cache
|
||||||
|
__pycache__
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
*.pyd
|
||||||
|
.Python
|
||||||
|
*.so
|
||||||
|
*.egg
|
||||||
|
*.egg-info
|
||||||
|
dist
|
||||||
|
build
|
||||||
|
|
||||||
|
# Virtual envs
|
||||||
|
.venv
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Docs & markdown (not needed in container)
|
||||||
|
docs/
|
||||||
|
docs-site/
|
||||||
|
*.md
|
||||||
|
|
||||||
|
# GitHub meta
|
||||||
|
.github/
|
||||||
|
|
||||||
|
# Frontend build is copied separately via --from
|
||||||
|
# so exclude the local build dir to keep context small
|
||||||
|
frontend/build/
|
||||||
|
frontend/.env
|
||||||
|
frontend/.env.local
|
||||||
|
frontend/.env.production
|
||||||
|
|
||||||
|
# Backend env
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!backend/env_template.txt
|
||||||
|
|
||||||
|
# Test files
|
||||||
|
**/test/
|
||||||
|
**/tests/
|
||||||
|
*.test.py
|
||||||
|
*.spec.py
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
*.log
|
||||||
|
logs/
|
||||||
|
|
||||||
|
# Temp
|
||||||
|
tmp/
|
||||||
|
temp/
|
||||||
|
*.tmp
|
||||||
72
Dockerfile
Normal file
72
Dockerfile
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
# ============================================================
|
||||||
|
# ALwrity Dockerfile — for EasyPanel deployment
|
||||||
|
# ============================================================
|
||||||
|
# Stage 1: Build frontend
|
||||||
|
FROM node:20-alpine AS frontend-builder
|
||||||
|
|
||||||
|
WORKDIR /app/frontend
|
||||||
|
|
||||||
|
# Copy package files
|
||||||
|
COPY frontend/package.json frontend/package-lock.json* ./
|
||||||
|
|
||||||
|
# Install deps (--legacy-peer-deps needed for react-scripts 5)
|
||||||
|
RUN npm install --legacy-peer-deps
|
||||||
|
|
||||||
|
# Copy frontend source
|
||||||
|
COPY frontend/ ./
|
||||||
|
|
||||||
|
# Build static assets
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# Stage 2: Python backend
|
||||||
|
FROM python:3.11-slim AS backend
|
||||||
|
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
ENV PORT=8000
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install build deps for some Python packages
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
libpq-dev \
|
||||||
|
curl \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Copy requirements first (for caching)
|
||||||
|
COPY backend/requirements.txt .
|
||||||
|
|
||||||
|
# Install Python deps
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Copy backend source
|
||||||
|
COPY backend/ ./backend/
|
||||||
|
|
||||||
|
# Copy frontend build artifacts from Stage 1
|
||||||
|
COPY --from=frontend-builder /app/frontend/build ./frontend/build
|
||||||
|
|
||||||
|
# Create workspace directories (created by start_alwrity_backend.py but ensure they exist)
|
||||||
|
RUN mkdir -p /app/lib/workspace/alwrity_content \
|
||||||
|
/app/lib/workspace/alwrity_web_research \
|
||||||
|
/app/lib/workspace/alwrity_prompts \
|
||||||
|
/app/lib/workspace/alwrity_config
|
||||||
|
|
||||||
|
# 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 with gunicorn + uvicorn workers (recommended for production)
|
||||||
|
# Fallback to plain uvicorn if gunicorn not installed
|
||||||
|
CMD python -m gunicorn backend.app:app \
|
||||||
|
--worker-class uvicorn.workers.UvicornWorker \
|
||||||
|
--bind 0.0.0.0:8000 \
|
||||||
|
--workers 2 \
|
||||||
|
--timeout 120 \
|
||||||
|
--access-logfile - \
|
||||||
|
--error-logfile - \
|
||||||
|
--log-level info
|
||||||
Reference in New Issue
Block a user