Repository navigation
Expand file tree
/
Copy pathDockerfile.dev
More file actions
50 lines (41 loc) · 1.52 KB
/
Copy pathDockerfile.dev
File metadata and controls
50 lines (41 loc) · 1.52 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
# Development Dockerfile with hot-reloading support for Rust backend
FROM rust:1.94-bookworm
# Install system dependencies for OCR and PDF processing
RUN apt-get update && apt-get install -y \
tesseract-ocr \
tesseract-ocr-all \
libtesseract-dev \
libleptonica-dev \
pkg-config \
libclang-dev \
clang \
poppler-utils \
ocrmypdf \
curl \
# Legacy DOC file support
antiword \
catdoc \
&& rm -rf /var/lib/apt/lists/*
# Install cargo-watch for auto-recompilation
RUN cargo install cargo-watch
WORKDIR /app
# Create necessary directories
RUN mkdir -p /app/uploads /app/watch /app/frontend
# Copy dependency files first for better caching
COPY Cargo.toml Cargo.lock ./
# Create dummy source files for all binaries to build dependencies
# This significantly speeds up the first cargo-watch build
RUN mkdir -p src/bin && \
echo "fn main() {}" > src/main.rs && \
echo "fn main() {}" > src/bin/test_runner.rs && \
echo "fn main() {}" > src/bin/analyze-webdav-performance.rs && \
cargo build && \
rm -rf src target
# The actual source code will be mounted as a volume
# This allows for hot-reloading without rebuilding the image
EXPOSE 8000
# Use cargo-watch to automatically rebuild and restart on file changes
# --why: shows what triggered the rebuild
# --ignore: ignore certain file patterns to avoid unnecessary rebuilds
# Run the main readur binary
CMD ["cargo", "watch", "-x", "run --bin readur", "--why", "--ignore", "frontend/*", "--ignore", "*.md", "--ignore", "test*"]