Convomate-module / Dockerfile
shevadesuyash's picture
Update Dockerfile
88cb000 verified
# Base image
FROM python:3.10-slim
# Environment variables for cache and config
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
HOME=/app \
HF_HOME=/app/.hf_cache \
LANGTOOL_HOME=/app/.ltool_cache \
XDG_CACHE_HOME=/app/.cache
# Create working directory and cache folders with full access
RUN mkdir -p /app/.hf_cache /app/.ltool_cache /app/.cache && \
chmod -R 777 /app/.hf_cache /app/.ltool_cache /app/.cache
# Install system dependencies
RUN apt-get update && apt-get install -y \
openjdk-17-jre-headless \
git \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy all project files
COPY . .
# Upgrade pip and install Python dependencies
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Pre-download and cache all required models
RUN python cache_models.py
# Set entrypoint script permissions
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Expose Flask default port
EXPOSE 7860
# Add this near the end of Dockerfile
RUN chmod -R a+w /app/.hf_cache
# Run app
CMD ["/app/entrypoint.sh"]