Add referral system and user balance tracking
Introduce balance field to User model with Alembic migration. Add referral menu, admin /refpay command, and deep link sharing. Update Dockerfile to multi-stage build and add Postgres service to compose. Fix deep link parsing logic and conditional proxy initialization.
This commit is contained in:
44
Dockerfile
44
Dockerfile
@@ -1,24 +1,38 @@
|
||||
FROM python:3.13-slim
|
||||
# Stage 1: Builder - Install dependencies
|
||||
FROM python:3.13-slim AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Install build-time dependencies required for compiling packages like asyncpg
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc \
|
||||
libpq-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
||||
|
||||
# Stage 2: Runner - Final lightweight image
|
||||
FROM python:3.13-slim AS runner
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies
|
||||
# Install runtime dependencies required by asyncpg
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
libpq5 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements first for better layer caching
|
||||
COPY requirements.txt .
|
||||
# Copy installed Python packages from the builder stage
|
||||
COPY --from=builder /install /usr/local
|
||||
|
||||
# Install Python dependencies
|
||||
RUN pip install --no-cache-dir --upgrade pip && \
|
||||
pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy entrypoint script
|
||||
COPY entrypoints/startup.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
# Copy application code (will be overridden by volume mount in development)
|
||||
# Copy application source code
|
||||
COPY . .
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
# Ensure the startup script is executable
|
||||
RUN chmod +x entrypoints/startup.sh
|
||||
|
||||
# Default command runs linting, migrations, and starts the bot
|
||||
CMD ["entrypoints/startup.sh"]
|
||||
|
||||
Reference in New Issue
Block a user