FROM r8.im/batouresearch/magic-image-refiner@sha256:507ddf6f977a7e30e46c0daefd30de7d563c72322f9e4cf7cbac52ef0f667b13 RUN useradd -m -u 1000 user RUN chown -R user:user /src/ RUN chown -R user:user /root/ USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONPATH=$HOME/app \ PYTHONUNBUFFERED=1 \ GRADIO_ALLOW_FLAGGING=never \ GRADIO_NUM_PORTS=1 \ GRADIO_SERVER_NAME=0.0.0.0 \ GRADIO_THEME=huggingface \ SYSTEM=spaces WORKDIR $HOME/app COPY ./requirements.txt /code/requirements.txt # create virtual env for Gradio app RUN python -m venv $HOME/.venv && \ . $HOME/.venv/bin/activate && \ pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r /code/requirements.txt COPY --chown=user . $HOME/app CMD ["sh", "run.sh"]