-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.threefold-cpu
More file actions
90 lines (74 loc) · 2.93 KB
/
Dockerfile.threefold-cpu
File metadata and controls
90 lines (74 loc) · 2.93 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# TFGrid flist runtime (CPU-only) — zinit-supervised, nginx on port 80
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive \
TZ=Etc/UTC \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONPATH=/opt/app:/opt/app/src \
HF_HOME=/opt/app/.cache/huggingface \
MPLCONFIGDIR=/tmp/matplotlib \
DATA_DIR=/opt/app/data
# System packages (original + nginx + openssh-server)
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.10 \
python3-pip \
python3.10-venv \
python3-dev \
git \
wget \
curl \
unzip \
ca-certificates \
build-essential \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgomp1 \
nginx \
openssh-server \
&& rm -rf /var/lib/apt/lists/*
# Make python3 point to python3.10
RUN ln -sf /usr/bin/python3.10 /usr/bin/python3
# Install zinit
RUN curl -fsSL https://github.com/threefoldtech/zinit/releases/download/v0.2.14/zinit \
-o /sbin/zinit && chmod +x /sbin/zinit
WORKDIR /opt/app
# Copy requirements first for better layer caching
COPY requirements.txt /opt/app/requirements.txt
# Upgrade pip and install Python dependencies
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel && \
python3 -m pip install --no-cache-dir -r requirements.txt && \
python3 -m pip install --no-cache-dir \
torch==2.5.1 \
torchvision==0.20.1 \
torchaudio==2.5.1 \
--index-url https://download.pytorch.org/whl/cpu && \
python3 -m pip install --no-cache-dir \
pytorch_fid==0.3.0 \
accelerate==0.26.1
# Copy service scripts and make executable
COPY scripts/ /opt/app/scripts/
RUN chmod +x /opt/app/scripts/*.sh
# Copy zinit service definitions
COPY zinit/ /etc/zinit/
# Copy nginx config (replace default site)
COPY nginx/default.conf /etc/nginx/sites-enabled/default
# Copy the full repository
COPY . /opt/app
# Download checkpoints and training data if they are not already present
RUN if [ -d /opt/app/data/ckpts ] && [ -d /opt/app/data/train_data ]; then \
echo "Data directories already present; skipping Zenodo download."; \
else \
wget -O /tmp/LatentDiffusion-2DChestCT-CCIA24_data.zip https://zenodo.org/records/19053504/files/LatentDiffusion-2DChestCT-CCIA24_data.zip && \
unzip -n /tmp/LatentDiffusion-2DChestCT-CCIA24_data.zip -d /opt/app && \
rm -r /tmp/LatentDiffusion-2DChestCT-CCIA24_data.zip; \
fi
# Re-apply execute bit after final COPY (COPY . overwrites the earlier chmod)
RUN chmod +x /opt/app/scripts/*.sh
# OCI labels
LABEL org.opencontainers.image.title="LatentDiffusion-2DChestCT-CCIA24-cpu" \
org.opencontainers.image.description="TFGrid flist — Characterization of Synthetic Lung Nodules in Conditional Latent Diffusion of Chest CT Scans (CPU-only)" \
org.opencontainers.image.source="https://github.com/multimedia-eurecat/LatentDiffusion-2DChestCT-CCIA24"
EXPOSE 80
ENTRYPOINT ["/sbin/zinit", "init"]