Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
0430395
1
Parent(s):
896066b
Have GUI be default mode of dockerfile
Browse files- Dockerfile +40 -1
Dockerfile
CHANGED
@@ -12,6 +12,24 @@ FROM python:${PYVERSION}-${BASE_IMAGE}
|
|
12 |
COPY --from=jl /usr/local/julia /usr/local/julia
|
13 |
ENV PATH="/usr/local/julia/bin:${PATH}"
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
# Install IPython and other useful libraries:
|
16 |
RUN pip install --no-cache-dir ipython matplotlib
|
17 |
|
@@ -21,6 +39,18 @@ WORKDIR /pysr
|
|
21 |
ADD ./requirements.txt /pysr/requirements.txt
|
22 |
RUN pip3 install --no-cache-dir -r /pysr/requirements.txt
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
# Install PySR:
|
25 |
# We do a minimal copy so it doesn't need to rerun at every file change:
|
26 |
ADD ./pyproject.toml /pysr/pyproject.toml
|
@@ -31,9 +61,18 @@ RUN pip3 install --no-cache-dir .
|
|
31 |
# Install Julia pre-requisites:
|
32 |
RUN python3 -c 'import pysr'
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
# metainformation
|
35 |
LABEL org.opencontainers.image.authors = "Miles Cranmer"
|
36 |
LABEL org.opencontainers.image.source = "https://github.com/MilesCranmer/PySR"
|
37 |
LABEL org.opencontainers.image.licenses = "Apache License 2.0"
|
38 |
|
39 |
-
CMD ["
|
|
|
12 |
COPY --from=jl /usr/local/julia /usr/local/julia
|
13 |
ENV PATH="/usr/local/julia/bin:${PATH}"
|
14 |
|
15 |
+
# Install dependencies for GUI:
|
16 |
+
RUN apt-get update && \
|
17 |
+
apt-get install -y --no-install-recommends \
|
18 |
+
build-essential \
|
19 |
+
git \
|
20 |
+
libgl1-mesa-glx \
|
21 |
+
libglib2.0-0 \
|
22 |
+
libpython3-dev \
|
23 |
+
libfreetype6-dev \
|
24 |
+
pkg-config \
|
25 |
+
libfontconfig1 \
|
26 |
+
fontconfig \
|
27 |
+
curl \
|
28 |
+
unzip \
|
29 |
+
&& \
|
30 |
+
apt-get clean && \
|
31 |
+
rm -rf /var/lib/apt/lists/*
|
32 |
+
|
33 |
# Install IPython and other useful libraries:
|
34 |
RUN pip install --no-cache-dir ipython matplotlib
|
35 |
|
|
|
39 |
ADD ./requirements.txt /pysr/requirements.txt
|
40 |
RUN pip3 install --no-cache-dir -r /pysr/requirements.txt
|
41 |
|
42 |
+
################################################################################
|
43 |
+
## GUI setup
|
44 |
+
# Install IBM Plex Mono font (so our plots look Gradio-style)
|
45 |
+
RUN mkdir -p /usr/local/share/fonts/IBM_Plex_Mono && \
|
46 |
+
curl -L https://github.com/IBM/plex/releases/download/v6.4.0/IBM-Plex-Mono.zip -o /tmp/IBM_Plex_Mono.zip && \
|
47 |
+
unzip /tmp/IBM_Plex_Mono.zip -d /usr/local/share/fonts/IBM_Plex_Mono && \
|
48 |
+
rm /tmp/IBM_Plex_Mono.zip
|
49 |
+
RUN fc-cache -f -v
|
50 |
+
ADD ./gui/requirements.txt /pysr/gui/requirements.txt
|
51 |
+
RUN pip3 install --no-cache-dir -r /pysr/gui/requirements.txt
|
52 |
+
################################################################################
|
53 |
+
|
54 |
# Install PySR:
|
55 |
# We do a minimal copy so it doesn't need to rerun at every file change:
|
56 |
ADD ./pyproject.toml /pysr/pyproject.toml
|
|
|
61 |
# Install Julia pre-requisites:
|
62 |
RUN python3 -c 'import pysr'
|
63 |
|
64 |
+
EXPOSE 7860
|
65 |
+
ENV GRADIO_ALLOW_FLAGGING=never \
|
66 |
+
GRADIO_NUM_PORTS=1 \
|
67 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
68 |
+
GRADIO_THEME=huggingface \
|
69 |
+
SYSTEM=spaces
|
70 |
+
|
71 |
+
ADD ./gui/app.py /pysr/gui/app.py
|
72 |
+
|
73 |
# metainformation
|
74 |
LABEL org.opencontainers.image.authors = "Miles Cranmer"
|
75 |
LABEL org.opencontainers.image.source = "https://github.com/MilesCranmer/PySR"
|
76 |
LABEL org.opencontainers.image.licenses = "Apache License 2.0"
|
77 |
|
78 |
+
CMD ["python3", "/pysr/gui/app.py"]
|