Spaces:
Running
Running
# Use the official Python image as base | |
FROM python:3.9 | |
# Set environment variables | |
ENV FLASK_APP=app.py \ | |
FLASK_RUN_HOST=0.0.0.0 \ | |
FLASK_RUN_PORT=7860 | |
# Set the working directory in the container | |
WORKDIR /app | |
# Copy the requirements file into the container at /app | |
COPY requirements.txt . | |
# Install any needed dependencies specified in requirements.txt | |
RUN pip install -r requirements.txt | |
# Expose the secret OPENAI_API_KEY environment variable at build time | |
RUN --mount=type=secret,id=OPENAI_API_KEY,mode=0444,required=true | |
# Copy the rest of the application code into the container at /app | |
COPY . . | |
# Expose the port that Flask is running on | |
EXPOSE 7860 | |
# Command to run the application when the container starts | |
CMD ["flask", "run"] | |