Spaces:
Runtime error
Runtime error
| # Use an official Python runtime as a parent image (e.g., 3.11 or 3.12) | |
| FROM python:3.11-slim | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Install system dependencies if needed (e.g., build-essential if compiling fastBPE) | |
| # RUN apt-get update && apt-get install -y --no-install-recommends build-essential && rm -rf /var/lib/apt/lists/* | |
| # Copy the requirements file into the container first (for Docker caching) | |
| COPY requirements.txt requirements.txt | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the application code and necessary files into the container | |
| # IMPORTANT: This assumes 'fast' is pre-compiled for Linux x86_64 | |
| COPY app.py . | |
| COPY hoc_best.pt . | |
| COPY bpecodes . | |
| COPY dict.txt . | |
| COPY fastbpe_exec . | |
| COPY templates/ ./templates/ | |
| # Ensure the 'fast' binary is executable within the container | |
| RUN chmod +x ./fastbpe_exec | |
| # Make port 5000 available (as defined in README.md and app.py) | |
| EXPOSE 5000 | |
| # Define environment variable for Python output buffering | |
| ENV PYTHONUNBUFFERED=1 | |
| # Run the app using waitress (a production-ready WSGI server) | |
| # Assumes your Flask app instance is named 'app' in 'app.py' | |
| CMD ["waitress-serve", "--host=0.0.0.0", "--port=5000", "app:app"] |