MogensR commited on
Commit
dd32d7f
·
1 Parent(s): 9adb277

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -11
Dockerfile CHANGED
@@ -9,6 +9,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
9
  TORCH_HOME=/data/torch \
10
  MPLCONFIGDIR=/tmp/mpl
11
 
 
12
  RUN mkdir -p /data/hf_cache /data/torch /app && chmod -R 777 /data
13
  WORKDIR /app
14
 
@@ -35,12 +36,12 @@ RUN set -eux; \
35
  echo "No packages.txt or empty — skipping APT extras."; \
36
  fi
37
 
38
- # ---- PyTorch wheels (cu121) — OK on CUDA 12.8 runtime ----
39
  RUN python3 -m pip install --upgrade pip
40
  RUN python3 -m pip install --index-url https://download.pytorch.org/whl/cu121 \
41
  torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1
42
 
43
- # ---- Python deps ----
44
  COPY requirements.txt /tmp/requirements.txt
45
  RUN if [ -s /tmp/requirements.txt ]; then \
46
  python3 -m pip install -r /tmp/requirements.txt; \
@@ -51,16 +52,14 @@ RUN if [ -s /tmp/requirements.txt ]; then \
51
  # ---- App code ----
52
  COPY . /app
53
 
54
- # (Optional) show GPU info in logs
55
- RUN python3 - << 'PY'
56
- import torch, os
57
- print("== PyTorch ==", torch.__version__)
58
- print("CUDA available:", torch.cuda.is_available(), "devices:", torch.cuda.device_count())
59
- if torch.cuda.is_available(): print("GPU0:", torch.cuda.get_device_name(0))
60
- print("HF cache:", os.getenv("HUGGINGFACE_HUB_CACHE"))
61
- PY
62
 
63
- # ---- Streamlit on HF Spaces (port 7860) ----
64
  EXPOSE 7860
65
  ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
66
  CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
9
  TORCH_HOME=/data/torch \
10
  MPLCONFIGDIR=/tmp/mpl
11
 
12
+ # Opret persistente mapper
13
  RUN mkdir -p /data/hf_cache /data/torch /app && chmod -R 777 /data
14
  WORKDIR /app
15
 
 
36
  echo "No packages.txt or empty — skipping APT extras."; \
37
  fi
38
 
39
+ # ---- PyTorch wheels (cu121) — fungerer CUDA 12.8 runtime ----
40
  RUN python3 -m pip install --upgrade pip
41
  RUN python3 -m pip install --index-url https://download.pytorch.org/whl/cu121 \
42
  torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1
43
 
44
+ # ---- Python dependencies ----
45
  COPY requirements.txt /tmp/requirements.txt
46
  RUN if [ -s /tmp/requirements.txt ]; then \
47
  python3 -m pip install -r /tmp/requirements.txt; \
 
52
  # ---- App code ----
53
  COPY . /app
54
 
55
+ # (Optional) GPU info i logs
56
+ RUN python3 -c "import os, torch; \
57
+ print('== PyTorch ==', torch.__version__); \
58
+ print('CUDA available:', torch.cuda.is_available(), 'devices:', torch.cuda.device_count()); \
59
+ print('GPU0:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'n/a'); \
60
+ print('HF cache:', os.getenv('HUGGINGFACE_HUB_CACHE'))"
 
 
61
 
62
+ # ---- Streamlit on HF Spaces ----
63
  EXPOSE 7860
64
  ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
65
  CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]