forked from DreamLab-AI/origin-logseq-AR
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathDockerfile.dev
More file actions
113 lines (91 loc) · 3.76 KB
/
Dockerfile.dev
File metadata and controls
113 lines (91 loc) · 3.76 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
105
106
107
108
109
110
111
112
113
# Development Docker image for WebXR with CUDA support (CachyOS)
# This image includes all build tools and ALWAYS builds the Rust backend on startup
# to ensure compatibility with the container's architecture
# SECURITY: Pin to digest for production builds (e.g., cachyos/cachyos-v3@sha256:abc123...)
FROM cachyos/cachyos-v3:latest
# Build argument for CUDA architecture (will be detected at runtime)
ARG CUDA_ARCH=86
ENV RUST_LOG=${RUST_LOG:-warn} \
PATH="/root/.cargo/bin:/opt/cuda/bin:${PATH}" \
NVIDIA_VISIBLE_DEVICES=all \
NVIDIA_DRIVER_CAPABILITIES=all \
CUDA_HOME=/opt/cuda \
CUDA_PATH=/opt/cuda \
CUDA_ARCH=${CUDA_ARCH} \
LD_LIBRARY_PATH="/opt/cuda/lib64:${LD_LIBRARY_PATH}"
# Initialize pacman keyring (required for CachyOS signature verification)
RUN pacman-key --init && \
pacman-key --populate archlinux cachyos && \
pacman -Sy --noconfirm archlinux-keyring cachyos-keyring && \
pacman -Syu --noconfirm && \
rm -rf /var/cache/pacman/pkg/*
# Install runtime dependencies and build tools (with retry logic)
RUN for attempt in 1 2 3; do \
echo "=== Package install attempt $attempt/3 ===" && \
pacman -S --noconfirm --needed \
curl \
git \
gcc \
base-devel \
openssl \
openbsd-netcat \
lsof \
expect \
docker \
nginx \
python python-pip \
&& break || { echo "Attempt $attempt failed, retrying in 10s..."; sleep 10; pacman -Syy --noconfirm; }; \
done && rm -rf /var/cache/pacman/pkg/*
# Install supervisor via pip (not available in pacman)
RUN pip install --break-system-packages supervisor
# Install CUDA via pacman (CachyOS installs to /opt/cuda)
RUN for attempt in 1 2 3; do \
echo "=== CUDA install attempt $attempt/3 ===" && \
pacman -S --noconfirm --needed cuda \
&& break || { echo "Attempt $attempt failed, retrying in 10s..."; sleep 10; pacman -Syy --noconfirm; }; \
done && rm -rf /var/cache/pacman/pkg/*
# Create Nginx log and run directories
RUN mkdir -p /var/log/nginx /var/run/nginx && \
chown -R http:http /var/run/nginx && \
which nginx && \
nginx -v
# 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 20.x LTS via tarball
RUN curl -fsSL https://nodejs.org/dist/v20.18.3/node-v20.18.3-linux-x64.tar.xz | \
tar -xJ -C /usr/local --strip-components=1
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
WORKDIR /app/client
RUN npm install
WORKDIR /app
# Pre-download Rust dependencies to speed up first build
RUN 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"]