File size: 1,217 Bytes
b6849ae
 
d10460c
b6849ae
 
 
 
 
 
d10460c
b6849ae
 
d10460c
b6849ae
 
 
 
 
d10460c
b6849ae
d10460c
53b5d00
d10460c
b6849ae
 
 
 
 
 
 
 
 
 
 
 
d10460c
b6849ae
 
17020cc
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
# ---- Base image ----
FROM python:3.10-slim

# Useful runtime env
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1

# ---- Workdir ----
WORKDIR /app

# ---- Python deps ----
COPY requirements.txt .
# Keep OS deps minimal (only if needed for some wheels)
RUN apt-get update && apt-get install -y --no-install-recommends \
    && pip install --no-cache-dir -r requirements.txt \
    && apt-get purge -y --auto-remove \
    && rm -rf /var/lib/apt/lists/*

# ---- App code ----
COPY . .
COPY olist.sqlite /tmp/olist.sqlite

# Streamlit & Matplotlib writable caches (mirrors the header you added in app.py)
ENV HOME=/app \
    XDG_CACHE_HOME=/app/.cache \
    MPLCONFIGDIR=/app/.mplconfig \
    STREAMLIT_SERVER_HEADLESS=true

RUN mkdir -p /app/.streamlit /app/.cache /app/.mplconfig

# (Optional) Streamlit server config – having this file in the repo also works
# RUN printf "[server]\nheadless = true\nport = 7860\naddress = \"0.0.0.0\"\nenableCORS = false\nenableXsrfProtection = false\n" > /app/.streamlit/config.toml

# ---- Network ----
EXPOSE 7860

# ---- Start ----
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableCORS=false"]