cox / Dockerfile
aripbae's picture
Update Dockerfile
3b77b7f verified
Raw
History Blame Contribute Delete
1.33 kB
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"]