-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (51 loc) · 2.01 KB
/
Dockerfile
File metadata and controls
64 lines (51 loc) · 2.01 KB
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
63
64
# Use an NVIDIA CUDA base image with Debian
FROM nvidia/cuda:12.8.1-cudnn-runtime-ubuntu24.04
# Set DEBIAN_FRONTEND to noninteractive to avoid timezone configuration prompts
ENV DEBIAN_FRONTEND=noninteractive
# Update package lists and install Python 3, curl (for UV), and build tools
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
curl \
build-essential \
python3-dev \
llvm-14 \
llvm-14-dev \
clang-14 \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
&& rm -rf /var/lib/apt/lists/*
# Verify that llvm-config is on PATH
RUN which llvm-config || true
RUN llvm-config --version || true
# Verify that Python has _sqlite3 with loadable extensions enabled
RUN python3 -c "import sqlite3; print('SQLite version:', sqlite3.sqlite_version)"
RUN python3 -c "import sqlite3; print('SQLite has loadable extensions:', sqlite3.connect(':memory:').enable_load_extension(True))"
# Set up llvm-config properly
RUN update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-14 100
RUN chmod a+rx /usr/bin/llvm-config-14 /usr/bin/llvm-config
RUN ls -l /usr/bin/llvm-config* && /usr/bin/llvm-config --version
# Create a directory for the application and adjust permissions for the existing user
RUN mkdir /app && chown -R 1000:1000 /app
# Set the working directory in the container
WORKDIR /app
# Switch to the existing user with UID 1000
USER 1000
# Add UV to PATH (uv installs to ~/.cargo/bin/uv usually, but this handles both possible locations)
ENV PATH="/home/ubuntu/.cargo/bin:/home/ubuntu/.local/bin:$PATH"
# Copy the project into the container
COPY --chown=1000:1000 . /app
# Create virtual environment and install dependencies with CUDA-enabled PyTorch
RUN bash ./install.sh
# Optional app config env vars
ENV ENABLE_CLIENT=false
ENV DISABLE_CLIENT_UPDATE=true
ENV HF_HOME=/home/ubuntu/.cache/huggingface
ENV TRANSFORMERS_CACHE=/home/ubuntu/.cache/huggingface
# Expose the app port
EXPOSE 6342
# Run the app with UV
CMD ["bash", "./start.sh"]