# Build stage
FROM rust:1.88.0 AS builder

WORKDIR /app

COPY ./task ./task
COPY ./cache ./cache
COPY ./storage ./storage

RUN cargo build --release --manifest-path ./task/Cargo.toml

# Runtime stage
FROM debian:bookworm-slim

WORKDIR /app

RUN apt-get update && apt-get install -y \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*

RUN mkdir /app/posts

COPY --from=builder /app/task/target/release/task /app/task
COPY --from=builder /app/cache ./cache
COPY --from=builder /app/storage ./storage

EXPOSE 3000

CMD ["/app/task"]
