forked from DreamLab-AI/VisionFlow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
104 lines (83 loc) · 3.12 KB
/
Dockerfile.dev
File metadata and controls
104 lines (83 loc) · 3.12 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# syntax=docker/dockerfile:1.7
# Development Docker image for WebXR with CUDA support
# This image includes all build tools and ALWAYS builds the Rust backend on startup
# to ensure compatibility with the container's architecture
FROM nvidia/cuda:12.4.1-devel-ubuntu22.04
# Build argument for CUDA architecture (will be detected at runtime)
ARG CUDA_ARCH=86
ENV DEBIAN_FRONTEND=noninteractive \
RUST_LOG=${RUST_LOG:-warn} \
PATH="/root/.cargo/bin:${PATH}" \
NVIDIA_DRIVER_CAPABILITIES=all \
CUDA_HOME=/usr/local/cuda \
LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}" \
CUDA_PATH=/usr/local/cuda
# Install runtime dependencies and build tools
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get install -y --no-install-recommends \
curl \
git \
gcc-11 \
g++-11 \
build-essential \
pkg-config \
libssl-dev \
netcat-openbsd \
lsof \
gzip \
expect \
docker.io \
supervisor \
nginx
# Create Nginx log and run directories
RUN mkdir -p /var/log/nginx /var/run/nginx && \
chown -R www-data:www-data /var/run/nginx && \
which nginx && \
nginx -v
# Set gcc-11 as default compiler (needed for CUDA compatibility)
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100
# Install Rust toolchain - REQUIRED for building on startup
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
ENV PATH="/root/.cargo/bin:${PATH}"
# Install Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs
WORKDIR /app
# Create necessary directories
# NOTE: /app/data will be mounted from host, so don't create subdirectories here
RUN mkdir -p /app/user_settings \
/app/client \
/app/logs \
/app/scripts
# Copy source code and build files
# These MUST be in the container for building on startup
COPY Cargo.toml build.rs ./
COPY src ./src
COPY schema ./schema
# Copy whelk-rs local dependency (required for cargo fetch)
COPY whelk-rs ./whelk-rs
# Copy client directory with all frontend files
COPY client ./client
# Install Node.js dependencies with cache mount
WORKDIR /app/client
RUN --mount=type=cache,target=/root/.npm \
npm install
WORKDIR /app
# Pre-download Rust dependencies to speed up first build
RUN --mount=type=cache,target=/root/.cargo/registry \
--mount=type=cache,target=/root/.cargo/git \
cargo fetch
# Copy runtime configuration files (no longer mounted to avoid conflicts)
COPY nginx.dev.conf /etc/nginx/nginx.conf
COPY data/settings.yaml /app/settings.yaml
COPY supervisord.dev.conf ./supervisord.dev.conf
# Copy entrypoint scripts
COPY scripts/dev-entrypoint.sh ./
COPY scripts/rust-backend-wrapper.sh ./scripts/
RUN chmod +x ./dev-entrypoint.sh ./scripts/rust-backend-wrapper.sh
EXPOSE 3001 4000 5173 24678
# The entrypoint will ALWAYS build the Rust backend on startup
# This ensures the binary matches the container's architecture
ENTRYPOINT ["./dev-entrypoint.sh"]