-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.dev
More file actions
56 lines (43 loc) · 1.35 KB
/
Dockerfile.dev
File metadata and controls
56 lines (43 loc) · 1.35 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
# Development Dockerfile for Rust application
FROM rust:slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
libmariadb-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# Verify Rust and Cargo are available
RUN rustc --version && cargo --version
# Install Diesel CLI for development
RUN cargo install diesel_cli --no-default-features --features mysql
# Set working directory
WORKDIR /app
# Copy dependency files
COPY Cargo.toml ./
# Create a dummy main.rs to build dependencies
RUN mkdir src && echo "fn main() {}" > src/main.rs
# Build dependencies (this layer will be cached)
RUN cargo build
# Remove dummy main.rs
RUN rm src/main.rs
# Copy source code
COPY src/ ./src/
COPY templates/ ./templates/
COPY migrations/ ./migrations/
# Create startup script
RUN echo '#!/bin/bash\n\
echo "Starting Sorting Office in development mode..."\n\
echo "Current directory: $(pwd)"\n\
echo "Environment variables:"\n\
env | grep -E "(DATABASE_URL|RUST_LOG|RUST_BACKTRACE)"\n\
echo "Running cargo run with full output..."\n\
set -x\n\
exec /usr/local/cargo/bin/cargo run 2>&1\n\
' > /app/start.sh && chmod +x /app/start.sh
# Expose ports
EXPOSE 3000 35729
# Set PATH to ensure cargo is available
ENV PATH="/usr/local/cargo/bin:${PATH}"
# Default command (can be overridden in docker-compose)
CMD ["/app/start.sh"]