Initial project structure in Rust with Rocket

This commit is contained in:
2026-07-22 17:08:43 -04:00
parent 0096259b4b
commit 7a65800892
7 changed files with 95 additions and 1 deletions
+30
View File
@@ -0,0 +1,30 @@
# --------------------
# STAGE 1: The Builder
FROM rust:1.96 as builder
WORKDIR /app
COPY Cargo.* ./
# Create a dummy main.rs so the dependencies can be compiled and cached
RUN mkdir src && \
echo "fn main() { println!(\"dummy\"); }" > src/main.rs
RUN cargo build --release
# Copy in the real source code changes
COPY src ./src
# Run the real build command
RUN cargo build --release
# --------------------
# STAGE 2: The Final, Minimal Image
FROM debian:stable-slim
WORKDIR /usr/src/druid
# Copy ONLY the compiled binary from the builder stage
COPY --from=builder /app/target/release/druid /usr/local/bin
ENV ROCKET_ADDRESS=0.0.0.0
# Define the command that runs your application
CMD ["/usr/local/bin/druid"]