File size: 1,071 Bytes
e4c9ad4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e7651f1
 
 
 
 
 
 
 
 
 
 
e4c9ad4
 
 
 
 
 
 
 
 
 
 
7606d61
 
e4c9ad4
 
 
 
e7651f1
 
 
 
 
 
 
7606d61
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
FROM python:3.10-slim

WORKDIR /code

# Install system dependencies required for cartopy and other packages
RUN apt-get update && apt-get install -y \
    gcc \
    g++ \
    libproj-dev \
    proj-data \
    proj-bin \
    libgeos-dev \
    libgeos-c1v5 \
    git \
    && rm -rf /var/lib/apt/lists/*

# Create data directory and set permissions
RUN mkdir -p /code/data && \
    chmod 777 /code/data

# Create matplotlib config directory and set permissions
RUN mkdir -p /tmp/matplotlib && \
    chmod 777 /tmp/matplotlib

# Set matplotlib config directory
ENV MPLCONFIGDIR=/tmp/matplotlib

# Copy requirements file
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY . .

# Set environment variables
ENV DATA_PATH=/code/data
ENV DASH_DEBUG_MODE=false
ENV PYTHONUNBUFFERED=1

# Expose port
EXPOSE 7860

# Create non-root user
RUN useradd -m -u 1000 appuser && \
    chown -R appuser:appuser /code

# Switch to non-root user
USER appuser

# Start the application
CMD ["python", "app.py"]