File size: 791 Bytes
7cb9bf8
 
6bff25b
 
 
daaa50a
7cb9bf8
0e96d80
 
 
 
 
 
6bff25b
daaa50a
0e96d80
7cb9bf8
daaa50a
7cb9bf8
 
6bff25b
 
 
 
 
 
 
 
 
 
 
 
 
0e96d80
daaa50a
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

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

WORKDIR /code

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    python3-dev \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install dependencies
COPY requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy application code
COPY . /code

# Create directory for generated apps with proper permissions
RUN mkdir -p /code/generated && \
    chown -R user:user /code/generated && \
    chmod 755 /code/generated

# Switch to non-root user
USER user

# Set environment
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONPATH=/code

# Command to run the application
CMD ["python", "app.py"]