|
|
|
FROM python:3.11 |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
COPY . /app |
|
|
|
|
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
EXPOSE 8000 |
|
|
|
|
|
ENV DJANGO_SETTINGS_MODULE=quizsite.settings |
|
ENV STATIC_BACKEND=whitenoise.storage.CompressedManifestStaticFilesStorage |
|
ENV DEBUG=True |
|
|
|
|
|
RUN --mount=type=secret,id=DBHOST,mode=0444,required=true \ |
|
--mount=type=secret,id=DBNAME,mode=0444,required=true \ |
|
--mount=type=secret,id=DBUSER,mode=0444,required=true \ |
|
--mount=type=secret,id=DBPASS,mode=0444,required=true \ |
|
--mount=type=secret,id=DBSSL,mode=0444,required=true \ |
|
--mount=type=secret,id=SECRET_KEY,mode=0444,required=true \ |
|
--mount=type=secret,id=OPENAI_API_KEY,mode=0444,required=true \ |
|
export DBHOST=$(cat /run/secrets/DBHOST) && \ |
|
export DBNAME=$(cat /run/secrets/DBNAME) && \ |
|
export DBUSER=$(cat /run/secrets/DBUSER) && \ |
|
export DBPASS=$(cat /run/secrets/DBPASS) && \ |
|
export DBSSL=$(cat /run/secrets/DBSSL) && \ |
|
export SECRET_KEY=$(cat /run/secrets/SECRET_KEY) && \ |
|
export OPENAI_API_KEY=$(cat /run/secrets/OPENAI_API_KEY) |
|
|
|
|
|
CMD ["python3", "src/manage.py", "runserver", "0.0.0.0:8000"] |