Spaces:
Paused
Paused
Update Dockerfile
Browse files1234567891011121314151617181920212223242526272829303132FROM python:3.9-slim# Create a non-root user to avoid permission issues at runtimeRUN useradd -m -u 1000 user# Set WORKDIR early so file ownership applies correctlyWORKDIR /app# Copy dependencies; specify ownership to avoid permission issuesCOPY --chown=user requirements.txt ./RUN pip install --no-cache-dir -r requirements.txt# Copy rest of your app into /app with correct ownershipCOPY --chown=user . .# Set the user to non-root for runtimeUSER userENV HOME=/home/userWORKDIR /app# Create a writable directory for files like fuel_properties.csvRUN mkdir -p data && chmod 777 data# Optionally set environment variables to ensure cache and configs are writableENV MPLCONFIGDIR=/home/user/.config/matplotlib \HF_HOME=/home/user/.cache/huggingface# Execute setup script during buildRUN chmod +x setup.sh && ./setup.sh# Expose the port and run your appEXPOSE 7860123456789101112131415161718192021222324252627282930313233FROM python:3.9-slim# Set working directoryWORKDIR /app# Install system dependenciesRUN apt-get update && apt-get install -y \build-essential \git \curl \&& rm -rf /var/lib/apt/lists/*# Copy requirements first (for better caching)COPY requirements.txt .# Install Python dependenciesRUN pip install --no-cache-dir -r requirements.txt# Copy all app files into containerCOPY . .# Make setup.sh executableRUN chmod +x setup.sh# Run setup.sh at build time so models are preloadedRUN ./setup.sh# Expose Streamlit portEXPOSE 7860# Expose the port and run your appEXPOSE 7860
Dockerfile+20-19