File size: 782 Bytes
ef737d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use a modern, slim Python image
FROM python:3.11-slim

# Install system dependencies if any are needed
RUN apt-get update && apt-get install -y \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Set up a non-root user for security
RUN useradd -m -u 1000 user
WORKDIR /app

# 1. First, install dependencies (for better layer caching)
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# 2. Copy the rest of the application
COPY --chown=user . .

# Sets environment variables
ENV PATH="/home/user/.local/bin:$PATH" \
    PYTHONUNBUFFERED=1 \
    AUTONOMY_ENV_DB=/app/autonomy_env.db

# Ensure the app starts on the correct port and host
EXPOSE 7860

# Launch the app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]