Teddy Xinyuan Chen
commited on
Commit
·
ce884e7
1
Parent(s):
9fbb706
2024-10-08T20-53-55Z
Browse files- Dockerfile +31 -0
Dockerfile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official Python 3.11 image from the Docker Hub
|
| 2 |
+
FROM python:3.11
|
| 3 |
+
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Copy the current directory contents into the container at /app
|
| 8 |
+
COPY . /app
|
| 9 |
+
|
| 10 |
+
# Install any needed packages specified in requirements-dev.txt
|
| 11 |
+
RUN pip install --no-cache-dir -r requirements-dev.txt
|
| 12 |
+
|
| 13 |
+
# Make port 8000 available to the world outside this container
|
| 14 |
+
EXPOSE 8000
|
| 15 |
+
|
| 16 |
+
# Set environment variables (non-sensitive)
|
| 17 |
+
ENV DJANGO_SETTINGS_MODULE=quizsite.settings
|
| 18 |
+
ENV STATIC_BACKEND=whitenoise.storage.CompressedManifestStaticFilesStorage
|
| 19 |
+
ENV DEBUG=True
|
| 20 |
+
|
| 21 |
+
# Set environment variables (sensitive) using Hugging Face secrets management
|
| 22 |
+
ENV DBHOST=$(cat /run/secrets/DBHOST)
|
| 23 |
+
ENV DBNAME=$(cat /run/secrets/DBNAME)
|
| 24 |
+
ENV DBUSER=$(cat /run/secrets/DBUSER)
|
| 25 |
+
ENV DBPASS=$(cat /run/secrets/DBPASS)
|
| 26 |
+
ENV DBSSL=$(cat /run/secrets/DBSSL)
|
| 27 |
+
ENV SECRET_KEY=$(cat /run/secrets/SECRET_KEY)
|
| 28 |
+
ENV OPENAI_API_KEY=$(cat /run/secrets/OPENAI_API_KEY)
|
| 29 |
+
|
| 30 |
+
# Run the Django application
|
| 31 |
+
CMD ["python3", "src/manage.py", "runserver", "0.0.0.0:8000"]
|