MilesCranmer commited on
Commit
bccdea1
1 Parent(s): 6cb0a58

Fix permissions issue in docker GUI

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -13
Dockerfile CHANGED
@@ -19,22 +19,36 @@ RUN mkdir -p /usr/local/share/fonts/IBM_Plex_Mono && \
19
  rm /tmp/IBM_Plex_Mono.zip
20
  RUN fc-cache -f -v
21
 
22
- WORKDIR /pysr
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  # Install all requirements, and then PySR itself
25
- ADD ./requirements.txt /pysr/requirements.txt
26
- RUN pip3 install --no-cache-dir -r /pysr/requirements.txt
27
 
28
- ADD ./gui/requirements.txt /pysr/gui/requirements.txt
29
- RUN pip3 install --no-cache-dir -r /pysr/gui/requirements.txt
30
 
31
- ADD ./pyproject.toml /pysr/pyproject.toml
32
- ADD ./setup.py /pysr/setup.py
33
- ADD ./pysr /pysr/pysr
34
- RUN pip3 install --no-cache-dir .
35
 
36
  # Install Julia pre-requisites:
37
- RUN python3 -c 'import pysr'
 
 
38
 
39
  EXPOSE 7860
40
  ENV GRADIO_ALLOW_FLAGGING=never \
@@ -43,11 +57,9 @@ ENV GRADIO_ALLOW_FLAGGING=never \
43
  GRADIO_THEME=huggingface \
44
  SYSTEM=spaces
45
 
46
- ADD ./gui/app.py /pysr/gui/app.py
47
-
48
  # metainformation
49
  LABEL org.opencontainers.image.authors = "Miles Cranmer"
50
  LABEL org.opencontainers.image.source = "https://github.com/MilesCranmer/PySR"
51
  LABEL org.opencontainers.image.licenses = "Apache License 2.0"
52
 
53
- CMD ["python3", "/pysr/gui/app.py"]
 
19
  rm /tmp/IBM_Plex_Mono.zip
20
  RUN fc-cache -f -v
21
 
22
+ # Set up a new user named "user" with user ID 1000
23
+ RUN useradd -m -u 1000 user
24
+ USER user
25
+ WORKDIR /home/user/
26
+ ENV HOME=/home/user
27
+ ENV PATH=/home/user/.local/bin:$PATH
28
+
29
+ RUN python -m venv $HOME/.venv
30
+
31
+ ENV PYTHON="${HOME}/.venv/bin/python"
32
+ ENV PIP="${PYTHON} -m pip"
33
+
34
+ WORKDIR $HOME/pysr
35
 
36
  # Install all requirements, and then PySR itself
37
+ COPY --chown=user ./requirements.txt $HOME/pysr/requirements.txt
38
+ RUN $PIP install --no-cache-dir -r $HOME/pysr/requirements.txt
39
 
40
+ COPY --chown=user ./gui/requirements.txt $HOME/pysr/gui/requirements.txt
41
+ RUN $PIP install --no-cache-dir -r $HOME/pysr/gui/requirements.txt
42
 
43
+ COPY --chown=user ./pyproject.toml $HOME/pysr/pyproject.toml
44
+ COPY --chown=user ./setup.py $HOME/pysr/setup.py
45
+ COPY --chown=user ./pysr $HOME/pysr/pysr
46
+ RUN $PIP install --no-cache-dir .
47
 
48
  # Install Julia pre-requisites:
49
+ RUN $PYTHON -c 'import pysr'
50
+
51
+ COPY --chown=user ./gui/app.py $HOME/pysr/gui/app.py
52
 
53
  EXPOSE 7860
54
  ENV GRADIO_ALLOW_FLAGGING=never \
 
57
  GRADIO_THEME=huggingface \
58
  SYSTEM=spaces
59
 
 
 
60
  # metainformation
61
  LABEL org.opencontainers.image.authors = "Miles Cranmer"
62
  LABEL org.opencontainers.image.source = "https://github.com/MilesCranmer/PySR"
63
  LABEL org.opencontainers.image.licenses = "Apache License 2.0"
64
 
65
+ CMD ["/home/user/.venv/bin/python", "/home/user/pysr/gui/app.py"]