Refactor authentication and session management
- Updated Dockerfile to use Python 3.13 and streamline system dependencies installation. - Enhanced user session handling in auth.py, introducing a centralized method for retrieving the current user from the session. - Removed deprecated auth routes and consolidated logic for user authentication and profile management. - Improved error handling and user feedback in redeem.py and teams.py, ensuring users are redirected to login when not authenticated. - Updated requirements.txt to include necessary packages for enhanced security and functionality. - Added phpMyAdmin service to docker-compose for easier database management.
This commit is contained in:
+13
-21
@@ -1,31 +1,23 @@
|
||||
# Use Python 3.11 (or whichever version you prefer)
|
||||
FROM python:3.11-slim
|
||||
FROM python:3.13
|
||||
|
||||
# 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/*
|
||||
# Install system dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends gcc libc-dev default-libmysqlclient-dev && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements first (for caching)
|
||||
# Copy requirements first to leverage Docker cache
|
||||
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 application code
|
||||
COPY . .
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8000
|
||||
# Set environment variables
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# Run the FastAPI app with Uvicorn
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
# Command to run when container starts
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--reload"]
|
||||
|
||||
Reference in New Issue
Block a user