|
FROM python:3.9-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Install necessary packages
|
|
RUN pip install --no-cache-dir flask gunicorn
|
|
|
|
# Copy the HTML file
|
|
COPY index.html /app/static/index.html
|
|
|
|
# Create a simple Flask app to serve the static file
|
|
RUN echo 'from flask import Flask, redirect\n\
|
|
app = Flask(__name__, static_folder="static")\n\
|
|
\n\
|
|
@app.route("/")\n\
|
|
def index():\n\
|
|
return redirect("/static/index.html")\n\
|
|
\n\
|
|
if __name__ == "__main__":\n\
|
|
app.run(host="0.0.0.0", port=7860)\n\
|
|
' > /app/app.py
|
|
|
|
# Expose the port that HuggingFace Spaces expects
|
|
EXPOSE 7860
|
|
|
|
# Start the server
|
|
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]
|
|
|