Download Dockerfile from dpv007/Chess-Web: direct link, hf CLI and curl.
- Browser
- Download file 2.49 kB
-
https://huggingface.co/spaces/dpv007/Chess-Web/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/dpv007/Chess-Web/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/dpv007/Chess-Web/resolve/main/Dockerfile
2.49 kB
| FROM ubuntu:24.04 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Install Python 3.12, pip, curl, build-essential, cmake, and SSL dev libraries for Rust | |
| RUN apt-get update && apt-get install -y \ | |
| python3 python3-pip python3-venv curl build-essential cmake pkg-config libssl-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a virtual environment so pip installs work smoothly | |
| ENV VIRTUAL_ENV=/opt/venv | |
| RUN python3 -m venv $VIRTUAL_ENV | |
| ENV PATH="$VIRTUAL_ENV/bin:$PATH" | |
| # Set up a new user named "user" with user ID 1000 (Required for HF Spaces) | |
| # Ubuntu 24.04 comes with a default "ubuntu" user with UID 1000. We must delete it first to avoid conflicts. | |
| RUN userdel -r ubuntu || true && useradd -m -u 1000 user && chown -R user:user /opt/venv | |
| # Switch to the "user" user | |
| USER user | |
| # Set home to the user's home directory and add Rust/Cargo to PATH | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:/home/user/.cargo/bin:$PATH | |
| # Install Rust for the specific user | |
| RUN curl https://sh.rustup.rs -sSf | sh -s -- -y | |
| # Set the working directory to the user's home directory | |
| WORKDIR $HOME/app | |
| # Copy the current directory contents into the container at $HOME/app setting the owner to the user | |
| COPY --chown=user . $HOME/app | |
| # Build the Rust engine | |
| RUN cd neural_engine && cargo build --release | |
| # Download all model weights from our model repository directly into the root folder | |
| RUN curl -L -o ./model.onnx "https://huggingface.co/dpv007/Neurex-Weights/resolve/main/model.onnx?v=5" || true | |
| RUN curl -L -o ./model.onnx.data "https://huggingface.co/dpv007/Neurex-Weights/resolve/main/model.onnx.data?v=5" || true | |
| RUN curl -L -o ./model_int8.onnx "https://huggingface.co/dpv007/Neurex-Weights/resolve/main/model_int8.onnx?v=5" || true | |
| RUN curl -L -o ./model_int8.onnx.data "https://huggingface.co/dpv007/Neurex-Weights/resolve/main/model_int8.onnx.data?v=5" || true | |
| # Prepare the Neurex_Engine folder | |
| RUN mkdir -p Neurex_Engine && \ | |
| cp neural_engine/target/release/neural_engine Neurex_Engine/Neurex && \ | |
| cp model.onnx Neurex_Engine/ || true && \ | |
| cp model_int8.onnx Neurex_Engine/ || true && \ | |
| cp vocab.json Neurex_Engine/ || true | |
| # Make engines executable | |
| RUN chmod +x Neurex_Engine/Neurex && \ | |
| chmod +x VeloCT_Ultimate || true | |
| # Install requirements | |
| RUN pip install --no-cache-dir -r requirements.txt && \ | |
| pip install --no-cache-dir -r lichess-bot/requirements.txt | |
| # Copy and make start script executable | |
| RUN chmod +x start.sh | |
| EXPOSE 7860 | |
| CMD ["./start.sh"] | |