File size: 1,328 Bytes
a532053
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13904c3
a532053
 
13904c3
a532053
 
 
 
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
50
51
# Use an official Python image as a base
FROM python:3.12-slim

RUN useradd -m -u 1000 user

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    gcc \
    libssl-dev \
    pkg-config \
    && rm -rf /var/lib/apt/lists/*

# Install Rust (required for orjson and other Rust-based Python packages)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
    && export PATH="$HOME/.cargo/bin:$PATH" \
    && rustc --version

# Ensure Rust is added to PATH for all subsequent RUN commands
ENV PATH="/root/.cargo/bin:$PATH"

# Set the working directory inside the container
WORKDIR /app

# Copy the pyproject.toml and any other build-related files
COPY --chown=user pyproject.toml .


# Install dependencies
RUN pip install --upgrade pip \
    && pip install uv crewai \
    && crewai install

# Ensure the /app directory is owned by the non-root user
RUN chown -R user:user /app

# Switch to the non-root user
USER user

# Copy the application code into the container
COPY --chown=user . .

# Expose the port on which the application will run it's a default Gradio port.
EXPOSE 7860

# Set the server name as 0.0.0.0 to access it from any host
ENV GRADIO_SERVER_NAME="0.0.0.0"

# Define the command to run your application
CMD ["uv", "run", "expressly"]