# Use the official Python 3.11 image from the Docker Hub FROM python:3.11 # Set the working directory in the container WORKDIR /app # Copy the current directory contents into the container at /app COPY . /app # Install any needed packages specified in requirements-dev.txt RUN pip install --no-cache-dir -r requirements-dev.txt # Make port 8000 available to the world outside this container EXPOSE 8000 # Set environment variables (non-sensitive) ENV DJANGO_SETTINGS_MODULE=quizsite.settings ENV STATIC_BACKEND=whitenoise.storage.CompressedManifestStaticFilesStorage ENV DEBUG=True # Set environment variables (sensitive) using Hugging Face secrets management ENV DBHOST=$(cat /run/secrets/DBHOST) ENV DBNAME=$(cat /run/secrets/DBNAME) ENV DBUSER=$(cat /run/secrets/DBUSER) ENV DBPASS=$(cat /run/secrets/DBPASS) ENV DBSSL=$(cat /run/secrets/DBSSL) ENV SECRET_KEY=$(cat /run/secrets/SECRET_KEY) ENV OPENAI_API_KEY=$(cat /run/secrets/OPENAI_API_KEY) # Run the Django application CMD ["python3", "src/manage.py", "runserver", "0.0.0.0:8000"]