johnbradley commited on
Commit
301df27
β€’
1 Parent(s): d505436

Fix Docker cache bug

Browse files

Fixes issue #5

Files changed (1) hide show
  1. Dockerfile +6 -5
Dockerfile CHANGED
@@ -1,7 +1,6 @@
1
  FROM python:3.9
2
 
3
  # Add settings taken from huggingface default container.
4
- WORKDIR /home/user/app
5
  RUN useradd -m -u 1000 user
6
  RUN apt-get update && apt-get install -y \
7
  git git-lfs ffmpeg libsm6 libxext6 \
@@ -13,15 +12,17 @@ RUN apt-get update && apt-get install -y \
13
  RUN pip install 'setuptools<58'
14
 
15
  # Install drexel_metadata dependencies
16
- COPY requirements.txt requirements.txt
17
- RUN pip install -r requirements.txt
18
 
19
  # Install gradio after main dependencies to prevent
20
  # `cannot import name 'deprecated' from 'typing_extensions'` error.
21
  RUN pip install gradio
22
 
 
 
23
  # Cache matplotlib fonts to improve startup time.
24
- RUN python -c "import matplotlib.pyplot"
25
 
26
- COPY . /home/user/app
27
  CMD python app.py
 
1
  FROM python:3.9
2
 
3
  # Add settings taken from huggingface default container.
 
4
  RUN useradd -m -u 1000 user
5
  RUN apt-get update && apt-get install -y \
6
  git git-lfs ffmpeg libsm6 libxext6 \
 
12
  RUN pip install 'setuptools<58'
13
 
14
  # Install drexel_metadata dependencies
15
+ COPY requirements.txt /tmp/requirements.txt
16
+ RUN pip install -r /tmp/requirements.txt
17
 
18
  # Install gradio after main dependencies to prevent
19
  # `cannot import name 'deprecated' from 'typing_extensions'` error.
20
  RUN pip install gradio
21
 
22
+ USER user
23
+ WORKDIR /home/user/app
24
  # Cache matplotlib fonts to improve startup time.
25
+ RUN mkdir /home/user/.cache && python -c "import matplotlib.pyplot"
26
 
27
+ COPY --chown=user . /home/user/app
28
  CMD python app.py