Teddy Xinyuan Chen commited on
Commit ·
65866d3
1
Parent(s): 0824581
Revert "2024-10-08T22-01-58Z"
Browse filesThis reverts commit 0824581e63f3bb73d8f8ab167378e6252e30544f.
- Dockerfile +21 -15
Dockerfile
CHANGED
|
@@ -7,7 +7,9 @@ WORKDIR /app
|
|
| 7 |
# Copy the current directory contents into the container at /app
|
| 8 |
COPY . /app
|
| 9 |
|
| 10 |
-
# Install any needed packages specified in requirements.txt
|
|
|
|
|
|
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
# Make port 8000 available to the world outside this container
|
|
@@ -16,19 +18,23 @@ EXPOSE 8000
|
|
| 16 |
# Set environment variables (non-sensitive)
|
| 17 |
ENV DJANGO_SETTINGS_MODULE=quizsite.settings
|
| 18 |
ENV STATIC_BACKEND=whitenoise.storage.CompressedManifestStaticFilesStorage
|
| 19 |
-
ENV DEBUG=
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
RUN
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
export
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
# Run the
|
| 34 |
-
CMD ["/
|
|
|
|
| 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 |
+
# my frozen requirements.txt
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
# Make port 8000 available to the world outside this container
|
|
|
|
| 18 |
# Set environment variables (non-sensitive)
|
| 19 |
ENV DJANGO_SETTINGS_MODULE=quizsite.settings
|
| 20 |
ENV STATIC_BACKEND=whitenoise.storage.CompressedManifestStaticFilesStorage
|
| 21 |
+
ENV DEBUG=True
|
| 22 |
|
| 23 |
+
# Set environment variables (sensitive) using Hugging Face secrets management
|
| 24 |
+
RUN --mount=type=secret,id=DBHOST,mode=0444,required=true \
|
| 25 |
+
--mount=type=secret,id=DBNAME,mode=0444,required=true \
|
| 26 |
+
--mount=type=secret,id=DBUSER,mode=0444,required=true \
|
| 27 |
+
--mount=type=secret,id=DBPASS,mode=0444,required=true \
|
| 28 |
+
--mount=type=secret,id=DBSSL,mode=0444,required=true \
|
| 29 |
+
--mount=type=secret,id=SECRET_KEY,mode=0444,required=true \
|
| 30 |
+
--mount=type=secret,id=OPENAI_API_KEY,mode=0444,required=true \
|
| 31 |
+
export DBHOST=$(cat /run/secrets/DBHOST) && \
|
| 32 |
+
export DBNAME=$(cat /run/secrets/DBNAME) && \
|
| 33 |
+
export DBUSER=$(cat /run/secrets/DBUSER) && \
|
| 34 |
+
export DBPASS=$(cat /run/secrets/DBPASS) && \
|
| 35 |
+
export DBSSL=$(cat /run/secrets/DBSSL) && \
|
| 36 |
+
export SECRET_KEY=$(cat /run/secrets/SECRET_KEY) && \
|
| 37 |
+
export OPENAI_API_KEY=$(cat /run/secrets/OPENAI_API_KEY)
|
| 38 |
|
| 39 |
+
# Run the Django application
|
| 40 |
+
CMD ["python3", "src/manage.py", "runserver", "0.0.0.0:8000"]
|