profileShare

rasmusjy / countrysense

Read-only snapshot

No repository description.

main default branch 19 files Expires Sep 13, 2026, 9:06 AM
Dockerfile 1,375 bytes
1 # syntax=docker/dockerfile:1
2
3 # CountrySense demo: CLIP ViT-B/16 klassifikaator protsessoril.
4 #
5 # Torch tuleb CPU-indeksist. Vaikimisi PyPI ratas veaks kaasa CUDA teegid, mis
6 # on paar gigabaiti kettal ja millest sellel serveril kasu ei ole.
7
8 FROM python:3.12-slim
9
10 WORKDIR /app
11 ENV PYTHONUNBUFFERED=1
12 ENV PIP_NO_CACHE_DIR=1
13 ENV PORT=3000
14 ENV COUNTRYSENSE_HOST=0.0.0.0
15 ENV COUNTRYSENSE_CKPT=runs/clip_vit_b16/best.pt
16 # Mudelikaal on checkpointis endas (pretrained=False), seega ei lae konteiner
17 # käivitumisel midagi alla. See seab kodukausta kirjutatavaks igaks juhuks.
18 ENV HF_HOME=/tmp/hf
19 ENV MPLCONFIGDIR=/tmp/mpl
20
21 RUN pip install --index-url https://download.pytorch.org/whl/cpu \
22 torch==2.13.0 torchvision==0.28.0 \
23 && pip install \
24 timm==1.0.28 \
25 pandas==2.2.3 \
26 numpy==2.2.6 \
27 pillow==11.3.0 \
28 "gradio>=6,<7"
29
30 COPY countrysense ./countrysense
31 COPY app.py ./
32 COPY runs/clip_vit_b16/best.pt ./runs/clip_vit_b16/best.pt
33 COPY runs/clip_vit_b16/metrics.json runs/clip_vit_b16/per_country.csv ./runs/clip_vit_b16/
34
35 RUN useradd -m -u 1001 demo && chown -R demo:demo /app
36 USER demo
37
38 EXPOSE 3000
39
40 HEALTHCHECK --interval=30s --timeout=10s --start-period=90s --retries=3 \
41 CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:3000/', timeout=8).status == 200 else 1)"
42
43 CMD ["python", "app.py"]
44