File size: 826 Bytes
a379324
0fd766e
a379324
 
 
 
0fd766e
d82ba02
0fd766e
 
a379324
d82ba02
a379324
 
0fd766e
d82ba02
 
 
 
 
 
 
 
 
 
 
 
 
 
a379324
d82ba02
a379324
 
d82ba02
 
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
FROM python:3.9-slim

# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential gcc libffi-dev libpq-dev curl && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

# Set workdir
WORKDIR /app

# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copy app code
COPY . .

# Create logs.json with correct permissions
RUN touch logs.json && \
    chown 1000:1000 logs.json && \
    chmod 664 logs.json

# Create and switch to non-root user
RUN useradd -m -u 1000 user
USER user

# Set environment
ENV PATH="/home/user/.local/bin:$PATH"

# Expose port
EXPOSE 7860

# Start app with uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2"]