File size: 1,332 Bytes
e8039cf 3b77b7f e8039cf 3b77b7f e8039cf 3b77b7f e8039cf 3b77b7f e8039cf 3b77b7f e8039cf 3b77b7f e8039cf 3b77b7f e8039cf 3b77b7f e8039cf 3b77b7f e8039cf 3b77b7f e8039cf 3b77b7f e8039cf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | FROM rust:bookworm AS builder
WORKDIR /app
RUN cargo init --bin --name hf-rust-api .
RUN cargo add tokio --features full && \
cargo add futures && \
cargo add serde --features derive && \
cargo add serde_json && \
cargo add warp --features server && \
cargo add anyhow && \
cargo add chaser-oxide@0.2.3
COPY main.rs src/main.rs
RUN cargo build --release
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
gnupg \
ca-certificates \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/googlechrome-keyring.gpg \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrome-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update && apt-get install -y --no-install-recommends \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
libxss1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/target/release/hf-rust-api ./main
RUN mkdir -p /tmp && chmod 777 /tmp
ENV CHROME_PATH=/usr/bin/google-chrome-stable
ENV HOME=/tmp
EXPOSE 7860
CMD ["./main"] |