Spaces:
Paused
Paused
| # Use an official Python runtime as a parent image | |
| FROM python:3.11-slim | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the requirements file into the container at /app | |
| COPY requirements.txt . | |
| # Install any needed packages specified in requirements.txt | |
| # Using --no-cache-dir to reduce image size | |
| # Using --default-timeout to prevent timeouts during pip install | |
| RUN pip install --no-cache-dir --default-timeout=300 -r requirements.txt | |
| # Copy the rest of the application code into the container at /app | |
| COPY . . | |
| # Create the log file and set its permissions before running the app | |
| RUN touch /app/gemini_proxy.log && chmod 666 /app/gemini_proxy.log | |
| # Set the default port for the application inside the container | |
| ENV GEMINI_PORT=7860 | |
| # Make port 7860 available to the world outside this container | |
| EXPOSE 7860 | |
| # Define other environment variables (defaults, can be overridden at runtime) | |
| ENV GEMINI_HOST=0.0.0.0 | |
| # SECURE_1PSID and SECURE_1PSIDTS must be passed at runtime for security | |
| ENV GEMINI_INIT_TIMEOUT=180 | |
| ENV GEMINI_REQUEST_TIMEOUT=300 | |
| ENV GEMINI_AUTO_CLOSE=false | |
| ENV GEMINI_CLOSE_DELAY=300 | |
| ENV GEMINI_AUTO_REFRESH=true | |
| ENV GEMINI_REFRESH_INTERVAL=540 | |
| ENV GEMINI_MAX_RETRIES=3 | |
| ENV GEMINI_RETRY_DELAY=2 | |
| ENV GEMINI_RETRY_EXCEPTIONS=RemoteProtocolError,ReadTimeout | |
| ENV GEMINI_LONG_RESPONSE_MODE=true | |
| ENV GEMINI_LONG_RESPONSE_WAIT=180 | |
| ENV GEMINI_MAX_LONG_RESPONSE_RETRIES=5 | |
| ENV GEMINI_KEEP_CONVERSATION_HISTORY=true | |
| ENV GEMINI_FILTER_THINKING_VESSEL=true | |
| # Command to run the application | |
| # The script will use environment variables for configuration, including GEMINI_PORT set above | |
| CMD ["python", "gemini_proxy_server.py"] |