Spaces:
Runtime error
Runtime error
File size: 1,141 Bytes
936da19 fc466e0 936da19 2c46e17 5d5bc3a 2c46e17 936da19 41b1025 |
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 35 36 37 38 39 40 |
# Base image with Conda
FROM continuumio/miniconda3
# Set working directory
WORKDIR /app
# --- ADD THESE LINES HERE ---
# Set environment variables to control cache locations
# This prevents permission errors by directing cache writes to a local .cache
# directory within our /app folder, which is always writable.
ENV HF_HOME=/app/.cache/huggingface
ENV MPLCONFIGDIR=/app/.cache/matplotlib
# ---------------------------
# Copy environment.yaml for conda
COPY environment.yaml /tmp/environment.yaml
# Create the Conda environment
RUN conda env create -f /tmp/environment.yaml
# Set default shell to use conda env
SHELL ["conda", "run", "--no-capture-output", "-n", "tirex", "/bin/bash", "-c"]
# Copy all project files and folders
COPY app.py /app/
COPY static /app/static
COPY data /app/data
COPY tirex /app/tirex
# Change ownership of the /app directory to the container's non-root user.
# This is crucial to allow the application to create cache files and directories.
RUN chown -R 1000:1000 /app
# Expose the default port
EXPOSE 7860
# Run your app
CMD ["conda", "run", "--no-capture-output", "-n", "tirex", "python", "app.py"]
|