Initial commit: ROA2WEB - FastAPI + Vue.js + Telegram Bot
Modern ERP Reports Application with microservices architecture Tech Stack: - Backend: FastAPI + python-oracledb (Oracle DB integration) - Frontend: Vue.js 3 + PrimeVue + Vite - Telegram Bot: python-telegram-bot + SQLite - Infrastructure: Shared database pool, JWT authentication, SSH tunnel Features: - FastAPI backend with async Oracle connection pool - Vue.js 3 responsive frontend with PrimeVue components - Telegram bot alternative interface - Microservices architecture with shared components - Complete deployment support (Linux Docker + Windows IIS) - Comprehensive testing (Playwright E2E + pytest) Repository Structure: - reports-app/ - Main application (backend, frontend, telegram-bot) - shared/ - Shared components (database pool, auth, utils) - deployment/ - Deployment scripts (Linux & Windows) - docs/ - Project documentation - security/ - Security scanning and git hooks
This commit is contained in:
70
reports-app/telegram-bot/Dockerfile
Normal file
70
reports-app/telegram-bot/Dockerfile
Normal file
@@ -0,0 +1,70 @@
|
||||
# Multi-stage build for optimized production image
|
||||
# Stage 1: Build dependencies
|
||||
FROM python:3.11-slim as builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
g++ \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements and install dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir --user -r requirements.txt
|
||||
|
||||
# Stage 2: Production image
|
||||
FROM python:3.11-slim as production
|
||||
|
||||
# Create non-root user for security
|
||||
RUN groupadd -r telegrambot && useradd -r -g telegrambot telegrambot
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install runtime dependencies only
|
||||
RUN apt-get update && apt-get install -y \
|
||||
tini \
|
||||
netcat-openbsd \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& apt-get clean
|
||||
|
||||
# Copy Python dependencies from builder stage
|
||||
COPY --from=builder /root/.local /home/telegrambot/.local
|
||||
|
||||
# Copy application code
|
||||
COPY app/ ./app/
|
||||
|
||||
# Create data directory for SQLite database
|
||||
RUN mkdir -p /app/data && chown -R telegrambot:telegrambot /app/data
|
||||
|
||||
# Set ownership and permissions
|
||||
RUN chown -R telegrambot:telegrambot /app
|
||||
|
||||
USER telegrambot
|
||||
|
||||
# Add user's local bin to PATH
|
||||
ENV PATH=/home/telegrambot/.local/bin:$PATH
|
||||
|
||||
# Environment variables with defaults
|
||||
ENV TELEGRAM_BOT_TOKEN="" \
|
||||
CLAUDE_API_KEY="" \
|
||||
BACKEND_URL="http://roa-backend:8000" \
|
||||
INTERNAL_API_PORT="8002" \
|
||||
SQLITE_DB_PATH="/app/data/telegram_bot.db" \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
# Health check - checks both internal API and bot status
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
CMD python -c "import httpx; import asyncio; asyncio.run(httpx.AsyncClient().get('http://localhost:8002/internal/health'))" || exit 1
|
||||
|
||||
# Expose internal API port
|
||||
EXPOSE 8002
|
||||
|
||||
# Use tini as init system for proper signal handling
|
||||
ENTRYPOINT ["/usr/bin/tini", "--"]
|
||||
|
||||
# Run the telegram bot application
|
||||
CMD ["python", "-m", "app.main"]
|
||||
Reference in New Issue
Block a user