File size: 779 Bytes
877b38e
 
 
4e0e3c6
 
 
877b38e
 
 
 
 
 
4e0e3c6
 
 
877b38e
4e0e3c6
 
 
 
877b38e
4e0e3c6
 
877b38e
 
4e0e3c6
 
 
 
 
 
 
 
 
877b38e
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
# Use Python base image
FROM python:3.12-slim-trixie

# Create non-root user
RUN useradd -m -u 1000 user

# Copy UV directly from official image
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Set working directory
WORKDIR /app

# Set UV cache in /tmp and HOME for the user
ENV UV_CACHE_DIR=/tmp/.cache/uv \
    HOME=/home/user

# Create cache directory with proper permissions
RUN mkdir -p /tmp/.cache/uv && \
    chown -R user:user /tmp/.cache && \
    chmod -R 777 /tmp/.cache

# Copy files first (as root)
COPY pyproject.toml ./
COPY main.py llm_utils.py ./

# Set proper permissions
RUN chown -R user:user /app && \
    chmod -R 755 /app

# Switch to user and install dependencies
USER user
RUN /bin/uv sync

# Run the application
CMD ["/bin/uv", "run", "main.py"]