# ---- Development stage ----
FROM rust:1.88-slim
RUN apt-get update && apt-get install -y \
curl \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Install cargo-watch for hot reloading
RUN cargo install cargo-watch --locked
WORKDIR /app
# Cache dependencies layer
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build
RUN rm -f target/debug/deps/auth0_integration*
# Copy actual source
COPY src ./src
COPY examples ./examples
# Shell aliases for development
RUN echo 'alias build="cargo build"' >> ~/.bashrc \
&& echo 'alias test="cargo test -- --nocapture"' >> ~/.bashrc \
&& echo 'alias run="cargo run --example debug_server"' >> ~/.bashrc \
&& echo 'alias watch="cargo watch -x run"' >> ~/.bashrc \
&& echo 'alias fmt="cargo fmt"' >> ~/.bashrc \
&& echo 'alias lint="cargo clippy -- -D warnings"' >> ~/.bashrc \
&& echo 'alias check="cargo check"' >> ~/.bashrc
EXPOSE 8080
# Hot reload by default in dev
CMD ["cargo", "watch", "-w", "src", "-w", "examples", "-x", "run --example debug_server"]