News-API / Dockerfile
dwfwfwfwf's picture
Update Dockerfile
0d735be verified
raw
history blame contribute delete
853 Bytes
# Use an official Python runtime as the base image
FROM python:3.9-slim
# Set the working directory inside the container
WORKDIR /app
# Install system dependencies (e.g., for feedparser and Flask)
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Download app.py and requirements.txt from Hugging Face dataset URLs
RUN curl -L -o app.py "https://huggingface.co/dwfwfwfwf/news-api-2.0/resolve/main/app.py"
RUN curl -L -o requirements.txt "https://huggingface.co/datasets/dwfwfwfwf/NEWS-API/resolve/main/requirements.txt"
# Install Python dependencies from requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 7860
# Set environment variables for Flask
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
# Command to run the Flask app
CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"]