FROM rust:1-slim-bookworm AS builder


WORKDIR /usr/src

COPY . .

RUN cargo build --release --bin gitara_web-cli

FROM debian:bookworm-slim

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

WORKDIR /usr/app

COPY --from=builder /usr/src/assets assets
COPY --from=builder /usr/src/config config
COPY --from=builder /usr/src/target/release/gitara_web-cli gitara_web-cli

ENV LOCO_ENV=production
EXPOSE 5150
ENTRYPOINT ["/usr/app/gitara_web-cli"]
CMD ["start"]
