Spaces:
Sleeping
Sleeping
Commit
·
ed7984d
1
Parent(s):
5fdba60
docker: add .dockerignore, update gitignore, Dockerfile, and compose for volumes & envs
Browse files- .dockerignore +57 -0
- .gitignore +6 -1
- Dockerfile +11 -5
- docker-compose.yml +6 -4
.dockerignore
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# --- Git metadata ---
|
| 2 |
+
.git
|
| 3 |
+
.gitignore
|
| 4 |
+
|
| 5 |
+
# --- Python ---
|
| 6 |
+
__pycache__/
|
| 7 |
+
*.py[cod]
|
| 8 |
+
*.pyo
|
| 9 |
+
*.so
|
| 10 |
+
*.dylib
|
| 11 |
+
.venv/
|
| 12 |
+
.env
|
| 13 |
+
.coverage
|
| 14 |
+
.ipynb_checkpoints/
|
| 15 |
+
|
| 16 |
+
# --- Data & Artifacts ---
|
| 17 |
+
data/
|
| 18 |
+
results/
|
| 19 |
+
logs/
|
| 20 |
+
exports/
|
| 21 |
+
hf-cache/
|
| 22 |
+
checkpoints/
|
| 23 |
+
*.log
|
| 24 |
+
*.tmp
|
| 25 |
+
*.db
|
| 26 |
+
|
| 27 |
+
# Models / weights
|
| 28 |
+
*.pt
|
| 29 |
+
*.pth
|
| 30 |
+
*.ckpt
|
| 31 |
+
*.safetensors
|
| 32 |
+
|
| 33 |
+
# W&B & experiment outputs
|
| 34 |
+
wandb/
|
| 35 |
+
wandb_logs/
|
| 36 |
+
|
| 37 |
+
# Predictions / exports
|
| 38 |
+
predictions_*.csv
|
| 39 |
+
app/demo/uploads/
|
| 40 |
+
app/demo/exports/
|
| 41 |
+
|
| 42 |
+
# OS junk
|
| 43 |
+
.DS_Store
|
| 44 |
+
|
| 45 |
+
# --- Exceptions (allow small fixtures/samples) ---
|
| 46 |
+
!data/dummy_images/
|
| 47 |
+
!data/dummy_images/COVID/*.png
|
| 48 |
+
!data/dummy_images/NORMAL/*.png
|
| 49 |
+
!data/dummy_images/VIRAL PNEUMONIA/*.png
|
| 50 |
+
!sample_data/**
|
| 51 |
+
!tests/**
|
| 52 |
+
!config/config.yaml.example
|
| 53 |
+
|
| 54 |
+
# --- Docker-specific ---
|
| 55 |
+
Dockerfile
|
| 56 |
+
docker-compose.yml
|
| 57 |
+
.dockerignore
|
.gitignore
CHANGED
|
@@ -13,7 +13,6 @@ __pycache__/
|
|
| 13 |
data/
|
| 14 |
results/
|
| 15 |
logs/
|
| 16 |
-
exports/
|
| 17 |
hf-cache/
|
| 18 |
checkpoints/
|
| 19 |
*.log
|
|
@@ -32,9 +31,15 @@ wandb_logs/
|
|
| 32 |
|
| 33 |
# Predictions / exports
|
| 34 |
predictions_*.csv
|
|
|
|
|
|
|
| 35 |
app/demo/uploads/
|
| 36 |
app/demo/exports/
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
# OS junk
|
| 39 |
.DS_Store
|
| 40 |
|
|
|
|
| 13 |
data/
|
| 14 |
results/
|
| 15 |
logs/
|
|
|
|
| 16 |
hf-cache/
|
| 17 |
checkpoints/
|
| 18 |
*.log
|
|
|
|
| 31 |
|
| 32 |
# Predictions / exports
|
| 33 |
predictions_*.csv
|
| 34 |
+
|
| 35 |
+
# Local run outputs
|
| 36 |
app/demo/uploads/
|
| 37 |
app/demo/exports/
|
| 38 |
|
| 39 |
+
# Docker volume outputs
|
| 40 |
+
uploads/
|
| 41 |
+
exports/
|
| 42 |
+
|
| 43 |
# OS junk
|
| 44 |
.DS_Store
|
| 45 |
|
Dockerfile
CHANGED
|
@@ -6,18 +6,24 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 6 |
git ffmpeg libsm6 libxext6 libgl1 curl \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
-
# 3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
-
#
|
| 13 |
COPY requirements.txt .
|
| 14 |
-
ENV PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1
|
| 15 |
RUN pip install --upgrade pip && pip install -r requirements.txt
|
| 16 |
|
| 17 |
-
#
|
| 18 |
COPY . .
|
| 19 |
|
| 20 |
-
#
|
| 21 |
ENV GRADIO_SERVER_NAME=0.0.0.0 \
|
| 22 |
GRADIO_SERVER_PORT=7860 \
|
| 23 |
MPLCONFIGDIR=/tmp/mpl
|
|
|
|
| 6 |
git ffmpeg libsm6 libxext6 libgl1 curl \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
+
# 3) Faster, cleaner Python logs + consistent HF cache location
|
| 10 |
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 11 |
+
PYTHONUNBUFFERED=1 \
|
| 12 |
+
HF_HOME=/root/.cache/huggingface \
|
| 13 |
+
PIP_NO_CACHE_DIR=1 \
|
| 14 |
+
PIP_DISABLE_PIP_VERSION_CHECK=1
|
| 15 |
+
|
| 16 |
+
# 4) Working directory
|
| 17 |
WORKDIR /app
|
| 18 |
|
| 19 |
+
# 5) Install Python deps first (better build caching)
|
| 20 |
COPY requirements.txt .
|
|
|
|
| 21 |
RUN pip install --upgrade pip && pip install -r requirements.txt
|
| 22 |
|
| 23 |
+
# 6) Copy your soucre code (done after deps so earlier layers cache)
|
| 24 |
COPY . .
|
| 25 |
|
| 26 |
+
# 7) Env for Gradio + Matplotlib
|
| 27 |
ENV GRADIO_SERVER_NAME=0.0.0.0 \
|
| 28 |
GRADIO_SERVER_PORT=7860 \
|
| 29 |
MPLCONFIGDIR=/tmp/mpl
|
docker-compose.yml
CHANGED
|
@@ -16,13 +16,15 @@ services:
|
|
| 16 |
volumes:
|
| 17 |
# Persist CSV/exports to your host (appears in ./exports)
|
| 18 |
- ./exports:/data/app/demo/exports
|
|
|
|
|
|
|
| 19 |
# Cache models between runs for speed
|
| 20 |
- ./hf-cache:/root/.cache/huggingface
|
|
|
|
|
|
|
| 21 |
healthcheck:
|
| 22 |
-
test: ["CMD", "
|
| 23 |
interval: 10s
|
| 24 |
timeout: 3s
|
| 25 |
retries: 5
|
| 26 |
-
|
| 27 |
-
# volumes:
|
| 28 |
-
# - .:/app
|
|
|
|
| 16 |
volumes:
|
| 17 |
# Persist CSV/exports to your host (appears in ./exports)
|
| 18 |
- ./exports:/data/app/demo/exports
|
| 19 |
+
# Persist uploads to your host (appears in ./uploads)
|
| 20 |
+
- ./uploads:/data/app/demo/uploads
|
| 21 |
# Cache models between runs for speed
|
| 22 |
- ./hf-cache:/root/.cache/huggingface
|
| 23 |
+
# Live-mount code
|
| 24 |
+
- .:/app
|
| 25 |
healthcheck:
|
| 26 |
+
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:${PORT:-7860}', timeout=2)"]
|
| 27 |
interval: 10s
|
| 28 |
timeout: 3s
|
| 29 |
retries: 5
|
| 30 |
+
|
|
|
|
|
|