-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruntime.Dockerfile
More file actions
114 lines (102 loc) · 3.65 KB
/
runtime.Dockerfile
File metadata and controls
114 lines (102 loc) · 3.65 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
ARG BASE_IMAGE=ubuntu:24.04
FROM $BASE_IMAGE
ARG FAST_VERSION=latest
ARG OPENCL_PLATFORM=pocl
ARG VIRTUALGL=false
ARG TYPE
ARG X_SERVER=xvfb
ARG VGL_VERSION=3.1.4
SHELL ["/bin/bash", "-c"]
# ============= Validate arguments
RUN if [ "${OPENCL_PLATFORM}" != "pocl" ] && \
[ "${OPENCL_PLATFORM}" != "intel" ] && \
[ "${OPENCL_PLATFORM}" != "nvidia" ]; then \
echo "Error: build-arg OPENCL_PLATFORM must be 'pocl', 'intel' or 'nvidia'." >&2; \
exit 1; \
fi; \
if [ "${TYPE}" != "library" ] && \
[ "${TYPE}" != "python" ]; then \
echo "Error: build-arg TYPE must be 'library' or 'python'." >&2; \
exit 1; \
fi; \
if [ "${X_SERVER}" != "xvfb" ] && \
[ "${X_SERVER}" != "none" ]; then \
echo "Error: build-arg X_SERVER must be 'xvfb' or 'none'." >&2; \
exit 1; \
fi; \
if [ "${VIRTUALGL}" != "true" ] && \
[ "${VIRTUALGL}" != "false" ]; then \
echo "Error: build-arg VIRTUALGL must be 'true' or 'false'." >&2; \
exit 1; \
fi
# =============> Install runtime dependencies
RUN apt update && apt install -y \
libxcb-xinerama0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-xkb1 \
libxkbcommon-x11-0 \
libxcb-shape0 \
libopengl0 \
libusb-1.0-0 \
libglib2.0-0t64 \
libglx0 \
libgl1 \
libsm6
# =============> Install OpenCL platform specific packages
# TODO NVIDIA
RUN if [ "${OPENCL_PLATFORM}" = "pocl" ]; then \
apt install -y libpocl2t64; \
elif [ "${OPENCL_PLATFORM}" = "intel" ]; then \
apt install -y intel-opencl-icd; \
elif [ "${OPENCL_PLATFORM}" = "nvidia" ]; then \
apt install -y nvidia-opencl-icd-340; \
fi
# ==============> Install X server specific packages
RUN if [ "${X_SERVER}" = "xvfb" ]; then \
apt install -y xvfb; \
fi
# ==============> Install and setup virtualgl
RUN if [ "${VIRTUALGL}" = "true" ]; then \
apt-get install -y wget libxtst6 libxv1 libglu1-mesa libegl1 && \
wget https://github.com/VirtualGL/virtualgl/releases/download/${VGL_VERSION}/virtualgl_${VGL_VERSION}_amd64.deb && \
dpkg -i virtualgl_${VGL_VERSION}_amd64.deb && \
./opt/VirtualGL/bin/vglserver_config -config +s +f +t && \
rm virtualgl_${VGL_VERSION}_amd64.deb; \
fi
# ==============> Install FAST according to TYPE and FAST_VERSION
COPY get_latest_fast_version.py /
COPY fast_version.py /
RUN if [ "${TYPE}" = "python" ]; then \
apt install -y python3 python3-pip python3-venv && \
python3 -m venv /environment && \
source /environment/bin/activate && \
pip install requests && \
pip install pyfast==$(python fast_version.py $FAST_VERSION) && \
pip cache purge; \
else \
apt install -y python3 python3-pip python3-venv wget libopenslide0 &&\
python3 -m venv /environment && \
source /environment/bin/activate && \
pip install requests && \
VERSION=$(python fast_version.py $FAST_VERSION) && \
wget https://github.com/FAST-Imaging/FAST/releases/download/v$VERSION/fast_ubuntu18.04_$VERSION.deb && \
dpkg -i fast_ubuntu18.04_$VERSION.deb && \
rm fast_*.deb \
deactivate \
rm -Rf /environment; \
fi
# ==============> Set environment variables
ENV LD_LIBRARY_PATH=/opt/fast/lib/
ENV TYPE=$TYPE
ENV VIRTUALGL=$VIRTUALGL
ENV X_SERVER=$X_SERVER
# ==============> Cleaning
RUN apt clean && apt autoremove
# ==============> Set init script as entrypoint
COPY entrypoint.sh /init/entrypoint.sh
COPY test_runtime_image.sh /test/test_runtime_image.sh
ENTRYPOINT ["./init/entrypoint.sh"]
CMD ["./test/test_runtime_image.sh"]