laa-algorithms-demo / Dockerfile
LOOFYYLO's picture
Upload Dockerfile with huggingface_hub
3fbe6f7 verified
raw
history blame contribute delete
942 Bytes
# Stage 1: Build the Rust core library in a full-featured environment
FROM python:3.9 as builder
# Install rustup and the Rust toolchain
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Copy the Rust project and build it
WORKDIR /app
COPY laa_core /app/laa_core
RUN cd laa_core && cargo build --release
# Stage 2: Create the final, minimal production image
FROM python:3.9-slim
WORKDIR /app
# Install Python dependencies
COPY requirements-hf.txt .
RUN pip install --no-cache-dir -r requirements-hf.txt
# Copy the built Rust library from the builder stage
COPY --from=builder /app/laa_core/target/release/liblaa_core.so /app/laa_core.so
# Copy the application code
COPY app.py .
# Expose the port Gradio runs on
EXPOSE 7860
# Run the Gradio app
CMD ["gradio", "app.py", "--server_name", "0.0.0.0"]