PySR / gui /Dockerfile
MilesCranmer's picture
Download IBM Plex Mono for GUI
e72c14a unverified
raw
history blame
1.91 kB
FROM julia:1.10.0 AS jl
FROM python:3.12
COPY --from=jl /usr/local/julia /usr/local/julia
ENV PATH="/usr/local/julia/bin:${PATH}"
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
git \
libgl1-mesa-glx \
libglib2.0-0 \
libpython3-dev \
libfreetype6-dev \
pkg-config \
libfontconfig1 \
fontconfig \
curl \
unzip \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install IBM Plex Mono font (so our plots look Gradio-style)
RUN mkdir -p /usr/local/share/fonts/IBM_Plex_Mono && \
curl -L https://github.com/IBM/plex/releases/download/v6.4.0/IBM-Plex-Mono.zip -o /tmp/IBM_Plex_Mono.zip && \
unzip /tmp/IBM_Plex_Mono.zip -d /usr/local/share/fonts/IBM_Plex_Mono && \
rm /tmp/IBM_Plex_Mono.zip
RUN fc-cache -f -v
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
WORKDIR /home/user/
# Set home to the user's home directory
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH
RUN python -m venv /home/user/.venv
# Install Python dependencies in a virtual environment
RUN /home/user/.venv/bin/python -m pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Install and pre-compile Julia dependencies,
# including the Bumper extension
RUN /home/user/.venv/bin/python -c "import pysr"
RUN /home/user/.venv/bin/python -c "import pysr; pysr.PySRRegressor(bumper=True, verbosity=0, progress=False, max_evals=1).fit([[1]], [1])"
WORKDIR /home/user/app
COPY --chown=user . $HOME/app
EXPOSE 7860
ENV GRADIO_ALLOW_FLAGGING=never \
GRADIO_NUM_PORTS=1 \
GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_THEME=huggingface \
SYSTEM=spaces
CMD ["/bin/bash", "-l", "-c", "/home/user/.venv/bin/python /home/user/app/app.py"]