File size: 1,060 Bytes
8364273 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# Use an official lightweight Python image.
FROM python:3.10-slim
# Install system packages required by some Python dependencies.
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
wget \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory inside the container.
WORKDIR /app
# Set environment variables for NLTK and Hugging Face Transformers cache directories.
ENV NLTK_DATA=/app/nltk_data
ENV TRANSFORMERS_CACHE=/app/transformers_cache
# Create the cache directories with permissions that allow writing.
RUN mkdir -p /app/nltk_data /app/transformers_cache && \
chmod -R 777 /app/nltk_data /app/transformers_cache
# Copy the requirements file and install the Python dependencies.
COPY requirements.txt .
RUN pip install --upgrade pip && pip install -r requirements.txt
# Copy your entire project into the container.
COPY . .
# Expose the port your Flask app will run on.
EXPOSE 7860
# Define the command to run your Flask app.
CMD ["python", "app.py"]
|