Spaces:
Sleeping
Sleeping
File size: 1,770 Bytes
fbca94e 3793f15 fda0968 011a5bb 3793f15 96dfb3e b6e426f 7af9b4b 5f83ec8 0d086e2 9087afa 109a0c8 011a5bb adb6ad5 011a5bb 6021e98 9b9e15b b76f7cc adb6ad5 e56da81 fbca94e 235bbc4 e56da81 fbca94e 1b68e82 109a0c8 e56da81 7063b82 109a0c8 adb6ad5 fbca94e 109a0c8 b0dbba9 b76f7cc |
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 |
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 if [ "$MODELSCOPE_ENVIRONMENT" = "studio" ]; then \
pnpm run build --mode target-rwkv-modelscope-space; \
else \
pnpm run build --mode target-rwkv-hf-space; \
fi
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 ["sh", "-c", "if [ \"$MODELSCOPE_ENVIRONMENT\" = \"studio\" ]; then CONFIG_FILE=\"./config.production-modelscope.yaml\"; else CONFIG_FILE=\"./config.production.yaml\"; fi; uv run app.py --config_file \"$CONFIG_FILE\""] |