FROM rust:slim-bullseye AS build

WORKDIR /root
COPY . .

RUN apt-get update \
&&  apt-get install -y pkg-config \
    build-essential \
    openssl \
    libssl-dev

RUN cargo build --release

FROM lwthiker/curl-impersonate:0.5-chrome-slim-bullseye

WORKDIR /root
COPY --from=build /root/target/release/bml_proxy /root/

ENV CURL_IMPERSONATE=chrome110
ENV LD_PRELOAD="/usr/local/lib/libcurl-impersonate-chrome.so"

CMD /root/bml_proxy
