File size: 1,909 Bytes
c9ef87b
375d20a
8ec0807
c9ef87b
 
5fed067
 
 
 
 
 
 
 
4eac491
 
 
 
e72c14a
 
5fed067
 
 
 
e72c14a
 
 
 
 
4eac491
 
8ec0807
 
 
 
4b720d9
 
 
 
27d64c8
4b720d9
 
 
 
f6dc423
5ed4b11
4b720d9
d50f3f0
8ec0807
a9e19e6
 
27d64c8
a9e19e6
8ec0807
27d64c8
4b720d9
8ec0807
5fed067
4de6d3f
 
 
 
 
5fed067
d50f3f0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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"]