content: # 1️⃣ Use the official Rust image as builder (latest stable with 2024 edition support)
  FROM rust:1.83 as builder
  
  # Install build dependencies
  RUN apt-get update && apt-get install -y \
      pkg-config \
      libssl-dev \
      && rm -rf /var/lib/apt/lists/*
  
  # 2️⃣ Set the working directory inside container
  WORKDIR /app
  
  ARG DATABASE_URL
  ENV DATABASE_URL=${DATABASE_URL}
  
  # 3️⃣ Copy all source code
  COPY . .
  
  # 4️⃣ Build the application
  RUN cargo build --release --locked
  
  # 6️⃣ Final stage: use a smaller base image
  FROM debian:bookworm-slim
  
  # Install necessary runtime dependencies
  RUN apt-get update && apt-get install -y \
      ca-certificates \
      libssl3 \
      && rm -rf /var/lib/apt/lists/*
  
  WORKDIR /usr/local/bin
  
  # 7️⃣ Copy the binary from builder stage
  COPY --from=builder /app/target/release/backened ./backened 
  
  # 8️⃣ Set binary as entry point
  ENTRYPOINT ["./backened"]
  