|
a |
|
b/torch.Dockerfile |
|
|
1 |
# syntax=docker/dockerfile:1 |
|
|
2 |
FROM pytorch/pytorch:2.3.1-cuda11.8-cudnn8-runtime |
|
|
3 |
RUN apt update |
|
|
4 |
ARG DEBIAN_FRONTEND=noninteractive |
|
|
5 |
ENV TZ=Etc/UTC |
|
|
6 |
|
|
|
7 |
# Install necessary packages |
|
|
8 |
RUN apt update && \ |
|
|
9 |
apt install -y liblapack-dev libblas-dev libgl1-mesa-glx libsm6 libxext6 wget vim g++ pkg-config libglib2.0-dev expat libexpat-dev libexif-dev libtiff-dev libgsf-1-dev openslide-tools libopenjp2-tools libpng-dev libtiff5-dev libjpeg-turbo8-dev libopenslide-dev python3-tk && \ |
|
|
10 |
sed -i '/^#\sdeb-src /s/^# *//' "/etc/apt/sources.list" && \ |
|
|
11 |
apt update && \ |
|
|
12 |
mkdir /scripts |
|
|
13 |
|
|
|
14 |
# Build libvips 8.15 from source [slideflow requires 8.9+] |
|
|
15 |
RUN apt install build-essential devscripts meson -y && \ |
|
|
16 |
mkdir /libvips && \ |
|
|
17 |
cd /libvips && \ |
|
|
18 |
wget https://github.com/libvips/libvips/archive/refs/tags/v8.15.3.tar.gz && \ |
|
|
19 |
tar zxf v8.15.3.tar.gz && \ |
|
|
20 |
cd /libvips/libvips-8.15.3 && \ |
|
|
21 |
meson setup build --prefix /usr/local/lib && \ |
|
|
22 |
cd /libvips/libvips-8.15.3/build && \ |
|
|
23 |
meson compile && \ |
|
|
24 |
meson install |
|
|
25 |
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib |
|
|
26 |
ENV SF_VIPS_VERSION=8.15.3 |
|
|
27 |
|
|
|
28 |
# Apply pytorch CuDNN patch |
|
|
29 |
WORKDIR "/opt/conda/lib" |
|
|
30 |
RUN ln -sn libnvrtc.so.11.8.89 libnvrtc.so |
|
|
31 |
|
|
|
32 |
# Install slideflow & download scripts |
|
|
33 |
WORKDIR "/scripts" |
|
|
34 |
ENV SF_BACKEND=torch |
|
|
35 |
RUN pip3 install slideflow[cucim,torch]==3.0.2 cupy-cuda11x slideflow-noncommercial slideflow-gpl versioneer && \ |
|
|
36 |
wget https://raw.githubusercontent.com/slideflow/slideflow/3.0.2/scripts/test.py && \ |
|
|
37 |
wget https://raw.githubusercontent.com/slideflow/slideflow/3.0.2/scripts/slideflow-studio.py && \ |
|
|
38 |
wget https://raw.githubusercontent.com/slideflow/slideflow/3.0.2/scripts/run_project.py && \ |
|
|
39 |
wget https://raw.githubusercontent.com/slideflow/slideflow/3.0.2/scripts/qupath_roi.groovy && \ |
|
|
40 |
wget https://raw.githubusercontent.com/slideflow/slideflow/3.0.2/scripts/qupath_roi_legacy.groovy && \ |
|
|
41 |
wget https://raw.githubusercontent.com/slideflow/slideflow/master/scripts/welcome.py && \ |
|
|
42 |
chmod +x /scripts/welcome.py |
|
|
43 |
|
|
|
44 |
# Set entrypoint |
|
|
45 |
ENTRYPOINT ["bash", "-c", "python3 /scripts/welcome.py && exec /bin/bash"] |