-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
86 lines (74 loc) · 2.98 KB
/
Dockerfile.dev
File metadata and controls
86 lines (74 loc) · 2.98 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
# Development Dockerfile with hot reload support
FROM rust:1.93-alpine
# Install development dependencies
# Includes Node.js and npm for TypeScript/JavaScript plugin development
RUN apk add --no-cache \
pkgconf \
openssl-dev \
openssl-libs-static \
musl-dev \
build-base \
postgresql-client \
curl \
libstdc++ \
libgcc \
clang \
mold \
nodejs \
npm
# Install uv (fast Python package manager) for Python plugin development
# uv provides 'uvx' command for running Python packages without installation
RUN wget -qO- https://astral.sh/uv/install.sh | sh && \
mv /root/.local/bin/uv /usr/local/bin/uv && \
mv /root/.local/bin/uvx /usr/local/bin/uvx
# Install PDFium library for PDF page rendering
# This enables rendering of text-only and vector PDF pages in development
# Note: Downloads architecture-specific binary based on TARGETARCH
ARG TARGETARCH
ARG PDFIUM_VERSION=latest
RUN if [ "$TARGETARCH" = "arm64" ]; then \
wget -q -O- https://github.com/bblanchon/pdfium-binaries/releases/${PDFIUM_VERSION}/download/pdfium-linux-musl-arm64.tgz \
| tar -xz -C /usr/local; \
else \
wget -q -O- https://github.com/bblanchon/pdfium-binaries/releases/${PDFIUM_VERSION}/download/pdfium-linux-musl-x64.tgz \
| tar -xz -C /usr/local; \
fi
# Ensure PDFium library can be found at runtime
# Create symlink in /usr/lib for standard library search path
RUN ln -sf /usr/local/lib/libpdfium.so /usr/lib/libpdfium.so
ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/lib
# Install cargo-watch for hot reloading and cargo-nextest for fast parallel tests
RUN cargo install cargo-watch cargo-nextest --locked
WORKDIR /app
# Copy Cargo workspace files for dependency caching
COPY Cargo.toml Cargo.lock ./
COPY .cargo/ ./.cargo/
COPY migration/Cargo.toml ./migration/
# Create dummy source files to build dependencies
# Disable static linking to enable dlopen() for PDFium dynamic loading
# This is required because musl's static linking doesn't support dlopen()
ENV OPENSSL_STATIC=1
ENV RUSTFLAGS="-C target-feature=-crt-static"
RUN mkdir -p src migration/src && \
echo "fn main() {}" > src/main.rs && \
echo "pub use sea_orm_migration::prelude::*; pub struct Migrator; impl MigratorTrait for Migrator { fn migrations() -> Vec<Box<dyn MigrationTrait>> { vec![] } }" > migration/src/lib.rs && \
cargo build && \
rm -rf src migration/src target/debug/.fingerprint/codex-* target/debug/.fingerprint/migration-*
# Copy the rest of the application
COPY . .
# Expose the application port
EXPOSE 8080
# Use cargo-watch for hot reloading
# Ignore frontend files and other non-Rust files to avoid unnecessary rebuilds
CMD ["cargo", "watch", \
"-w", ".cargo-watch.toml", \
"-w", "Cargo.toml", \
"-w", "Cargo.lock", \
"-w", "src/", \
"-w", "migration/", \
"-i", "web/**", \
"-i", "docs/**", \
"-i", "*.md", \
"-i", "Dockerfile*", \
"-i", "docker-compose*.yml", \
"-x", "run -- serve --config /app/config/config.docker.yaml"]