Teddy Xinyuan Chen
commited on
Commit
·
0824581
1
Parent(s):
c483669
2024-10-08T22-01-58Z
Browse files- Dockerfile +15 -21
Dockerfile
CHANGED
@@ -7,9 +7,7 @@ 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
|
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,23 +16,19 @@ EXPOSE 8000
|
|
18 |
# Set environment variables (non-sensitive)
|
19 |
ENV DJANGO_SETTINGS_MODULE=quizsite.settings
|
20 |
ENV STATIC_BACKEND=whitenoise.storage.CompressedManifestStaticFilesStorage
|
21 |
-
ENV DEBUG=
|
22 |
|
23 |
-
#
|
24 |
-
RUN
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
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
|
40 |
-
CMD ["
|
|
|
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 |
# Set environment variables (non-sensitive)
|
17 |
ENV DJANGO_SETTINGS_MODULE=quizsite.settings
|
18 |
ENV STATIC_BACKEND=whitenoise.storage.CompressedManifestStaticFilesStorage
|
19 |
+
ENV DEBUG=False
|
20 |
|
21 |
+
# Create a script to read secrets and run the application
|
22 |
+
RUN echo '#!/bin/bash\n\
|
23 |
+
export DBHOST=$(cat /run/secrets/DBHOST)\n\
|
24 |
+
export DBNAME=$(cat /run/secrets/DBNAME)\n\
|
25 |
+
export DBUSER=$(cat /run/secrets/DBUSER)\n\
|
26 |
+
export DBPASS=$(cat /run/secrets/DBPASS)\n\
|
27 |
+
export DBSSL=$(cat /run/secrets/DBSSL)\n\
|
28 |
+
export SECRET_KEY=$(cat /run/secrets/SECRET_KEY)\n\
|
29 |
+
export OPENAI_API_KEY=$(cat /run/secrets/OPENAI_API_KEY)\n\
|
30 |
+
python3 src/manage.py runserver 0.0.0.0:8000\n'\
|
31 |
+
> /app/run.sh && chmod +x /app/run.sh
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
# Run the script
|
34 |
+
CMD ["/app/run.sh"]
|