Custom Dockerfile in spaces

I am runnig this properly on my machine with dockerfile but unable to run on spaces:

FROM python:3.10
# RUN useradd -m -u 1000 user
# switch to user
# USER user
# Set home to the user's home directory
ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH

WORKDIR /$HOME/app


# Install dependencies including gcc and graphviz
RUN apt-get update && \
    apt-get install -y gcc graphviz graphviz-dev libgraphviz-dev \
    apt-get clean && rm -rf /var/lib/apt/lists/*

# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app

# Expose port
EXPOSE 7860
ENV GRADIO_SERVER_NAME="0.0.0.0"
ENV GRADIO_SERVER_PORT="7860"
ENV GROQ_API_KEY=$(cat /run/secrets/GROQ_API_KEY)
CMD [ "gradio" ,"app.py" ]

I am facing issue: like linux dependecis issue even i am running installing linux dependencies.
Here is the error log:

      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DSWIG_PYTHON_STRICT_BYTE_CHAR -I/usr/local/include/python3.10 -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-cpython-310/pygraphviz/graphviz_wrap.o
      pygraphviz/graphviz_wrap.c:9: warning: "SWIG_PYTHON_STRICT_BYTE_CHAR" redefined
          9 | #define SWIG_PYTHON_STRICT_BYTE_CHAR
            |
      <command-line>: note: this is the location of the previous definition
      pygraphviz/graphviz_wrap.c:3023:10: fatal error: graphviz/cgraph.h: No such file or directory
       3023 | #include "graphviz/cgraph.h"
            |          ^~~~~~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pygraphviz
  Building wheel for wikipedia (setup.py): started
  Building wheel for wikipedia (setup.py): finished with status 'done'
  Created wheel for wikipedia: filename=wikipedia-1.4.0-py3-none-any.whl size=11680 sha256=1b9a3fec1cc50a18afabd4f74e9b357cef6434130108438027adfda97dc5ada9
  Stored in directory: /tmp/pip-ephem-wheel-cache-7jj7rv7d/wheels/b2/7f/26/524faff9145e274da278dc97d63ab0bfde1f791ecf101a9c95
Successfully built ffmpy wikipedia
Failed to build pygraphviz
ERROR: Could not build wheels for pygraphviz, which is required to install pyproject.toml-based projects

[notice] A new release of pip available: 22.3.1 -> 24.1.1
[notice] To update, run: pip install --upgrade pip

--> ERROR: process "/bin/sh -c pip install --no-cache-dir -r /tmp/requirements.txt" did not complete successfully: exit code: 1

why is the pip not upgraded and requirend depend not installed?