Digital-Galatea / Dockerfile
codejedi's picture
Move NLTK download from Docker build to app initialization to reduce image size
dad61a1
raw
history blame contribute delete
685 Bytes
# Use Python 3.10 slim image
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies with retry logic
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
pip install --no-cache-dir -r requirements.txt
# Copy the entire application
COPY . .
# Expose the port the app runs on
EXPOSE 7860
# Set environment variable for port
ENV PORT=7860
# Run the application
CMD ["python", "app.py"]