Translate-all / Dockerfile
Asrasahar's picture
Update Dockerfile
bbc9c1a verified
# 1. Base Image: Python 3.9 slim version
FROM python:3.9-slim
# 2. Set Environment Variables
# Prevents Python from writing pyc files to disc (optional but good practice)
ENV PYTHONDONTWRITEBYTECODE 1
# Ensures Python output is sent straight to terminal (good for logging)
ENV PYTHONUNBUFFERED 1
# 3. Set Working Directory
WORKDIR /app
# 4. Copy requirements.txt and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 5. Copy the rest of the application code
COPY . .
# 6. Expose the port the app runs on (Hugging Face default)
EXPOSE 7860
# 7. Command to run the application using Flask's built-in server
# For more robust production, consider Gunicorn (see commented line below)
# Make sure FLASK_RUN_PORT is set, or Flask will default to 5000
ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_RUN_PORT=7860
CMD ["flask", "run"]
# Alternative: Command to run with Gunicorn (recommended for stability)
# If using Gunicorn, add "gunicorn" to requirements.txt and uncomment the line below
# CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]