Spaces:
Running
on
T4
Running
on
T4
| FROM node:20-alpine AS FrontendBuilder | |
| RUN apk update && apk upgrade && \ | |
| apk add --no-cache bash git openssh curl rust cargo | |
| RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
| RUN npm install -g pnpm | |
| ADD https://api.github.com/repos/SolomonLeon/web-rwkv-realweb/git/refs/heads/ version_1.json | |
| WORKDIR /app | |
| RUN git clone https://github.com/SolomonLeon/web-rwkv-realweb.git /app | |
| WORKDIR /app/web-rwkv-wasm | |
| RUN ["cargo", "install", "wasm-pack"] | |
| WORKDIR /app | |
| ENV PATH=/root/.cargo/bin:$PATH | |
| RUN pnpm install | |
| RUN pnpm run build --mode target-rwkv-hf-space | |
| FROM nvidia/cuda:12.4.0-devel-ubuntu22.04 AS Backend | |
| RUN <<EOF | |
| apt update | |
| apt install --no-install-recommends -y \ | |
| build-essential \ | |
| git \ | |
| cuda-nvcc-12-4 \ | |
| cuda-cudart-dev-12-4 \ | |
| python3-dev \ | |
| python3-pip \ | |
| libpython3.10-dev | |
| apt clean && rm -rf /var/lib/apt/lists/* | |
| EOF | |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ | |
| COPY . . | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/usr/local/cuda/bin:/home/user/.local/bin:$PATH \ | |
| LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}" \ | |
| CXX=/usr/bin/g++ \ | |
| TORCH_CUDA_ARCH_LIST="7.5" | |
| WORKDIR $HOME/app | |
| COPY --chown=user . $HOME/app | |
| COPY --chown=user --from=FrontendBuilder /app/dist $HOME/app/dist-frontend | |
| RUN uv sync --frozen --extra cu124 | |
| CMD ["uv","run","app.py","--config_file","./config.production.yaml"] | |