4a79c5cacb
- Added `is_admin` field to User model for role management. - Updated user context middleware to include current user in templates. - Enhanced session management with improved debug middleware. - Refactored dashboard view to fetch user-specific data and recent events. - Improved login and registration templates for better user experience. - Added admin routes with access control for admin users. - Updated Docker configuration for better error logging and dependency management. - Updated requirements to include new dependencies and specify versions.
32 lines
781 B
Docker
32 lines
781 B
Docker
# Use Python 3.11 (or whichever version you prefer)
|
|
FROM python:3.11-slim
|
|
|
|
# Create working directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies needed for mysqlclient
|
|
RUN apt-get update && apt-get install -y \
|
|
pkg-config \
|
|
default-libmysqlclient-dev \
|
|
build-essential \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements first (for caching)
|
|
COPY requirements.txt .
|
|
|
|
# Install dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Explicitly install pymysql (in case it's missing from requirements.txt)
|
|
RUN pip install --no-cache-dir pymysql cryptography
|
|
|
|
# Copy the rest of the code
|
|
COPY . .
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Run the FastAPI app with Uvicorn
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|