TiRex-demo / Dockerfile
Nikita
ownership of /app repository
2c46e17
raw
history blame
1.14 kB
# 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 jovyan:jovyan /app
# Expose the default port
EXPOSE 7860
# Run your app
CMD ["conda", "run", "--no-capture-output", "-n", "tirex", "python", "app.py"]