drexel_metadata_app / Dockerfile
johnbradley's picture
Fix Docker cache bug
301df27
raw
history blame
846 Bytes
FROM python:3.9
# Add settings taken from huggingface default container.
RUN useradd -m -u 1000 user
RUN apt-get update && apt-get install -y \
git git-lfs ffmpeg libsm6 libxext6 \
cmake libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/* \
&& git lfs install
# Use older setuptools to avoid 2to3 error with dependencies.
RUN pip install 'setuptools<58'
# Install drexel_metadata dependencies
COPY requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt
# Install gradio after main dependencies to prevent
# `cannot import name 'deprecated' from 'typing_extensions'` error.
RUN pip install gradio
USER user
WORKDIR /home/user/app
# Cache matplotlib fonts to improve startup time.
RUN mkdir /home/user/.cache && python -c "import matplotlib.pyplot"
COPY --chown=user . /home/user/app
CMD python app.py