FROM python:3.10 WORKDIR /code COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Create Docker secret RUN mkdir -p /app/secrets # Use the Docker secret at build time to write it to a file RUN --mount=type=secret,id=GOOGLEAPI_SECRET,mode=0444,required=true \ cat /run/secrets/GOOGLEAPI_SECRET > /app/secrets/googleapi_secret.json RUN --mount=type=secret,id=FB_SECRET,mode=0444,required=true \ cat /run/secrets/FB_SECRET > /app/secrets/fb_secret.json RUN --mount=type=secret,id=OPENAI_KEY,mode=0444,required=true \ cat /run/secrets/OPENAI_KEY > /app/secrets/openai_key.txt RUN --mount=type=secret,id=GEMINI_KEY,mode=0444,required=true \ cat /run/secrets/GEMINI_KEY > /app/secrets/gemini_key.txt # Set the GOOGLE_APPLICATION_CREDENTIALS environment variable ENV GOOGLE_APPLICATION_CREDENTIALS="/app/secrets/googleapi_secret.json" COPY . . CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]