File size: 948 Bytes
2a06b2a
 
 
 
05b779c
 
 
 
 
 
2a06b2a
 
 
0e8b1df
 
 
 
 
05b779c
2a06b2a
 
0e8b1df
 
90d34ea
9841510
1335c94
 
 
 
 
9841510
90d34ea
 
 
 
f22f614
05b779c
f22f614
2a06b2a
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
FROM python:3.11-slim

WORKDIR /code

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

# Copy requirements first to leverage Docker cache
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Create data directory with correct permissions
RUN mkdir -p /data && \
    chmod -R 777 /data && \
    chown -R 1000:1000 /data

# Copy the rest of the application
COPY . /code/

# Set code directory permissions
RUN chmod -R 777 /code && \
    chown -R 1000:1000 /code

# Create instance directory with correct permissions
RUN mkdir -p /code/instance && \
    chmod -R 777 /code/instance && \
    chown -R 1000:1000 /code/instance

# Switch to non-root user
USER 1000:1000

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

# Run the application with proper permissions
CMD ["python", "app.py"]