-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile.gpu
57 lines (47 loc) · 2.65 KB
/
Dockerfile.gpu
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
# vantage6 base image
# FROM harbor.vantage6.ai/algorithms/algorithm-base
# FROM nvidia/cuda:11.0.3-base-ubuntu20.04
# FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
FROM tensorflow/tensorflow:2.10.0-gpu
ARG PKG_NAME="federated_brain_age"
# Required for the psycopg2 dependency
RUN apt-get update
RUN apt-get install -y apt-utils gcc libpq-dev gnupg curl software-properties-common
# Install python
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update
RUN apt-get install -y python3.8 python3-pip
RUN ln -s /usr/bin/python3 /usr/bin/python
# GPU dependencies
RUN distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
RUN curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | \
apt-key add -distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | \
tee /etc/apt/sources.list.d/nvidia-container-runtime.list
# RUN curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | \
# apt-key add - \
# && distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
# && curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list |
# nvidia-docker2
RUN apt-get update && apt-get install -y nvidia-container-runtime nvidia-container-toolkit nvidia-docker2
# RUN apt-get install -y vim
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib/x86_64-linux-gnu"
# Temporary folder used for certain applications where it is recommended to
# copy the data first to the container instead of using a persistent storage
# (improves speed for reading/writing)
# RUN mkdir /mnt/temporary
# RUN chmod 777 /mnt/temporary
# install the federated algorithm
# requirements filed used for development
COPY ./requirements-gpu.txt /requirements.txt
RUN pip install -r requirements.txt
COPY . /app
RUN pip install /app
ENV PKG_NAME=${PKG_NAME}
# TODO: Temporary solution for a continous task manager running in a container
# COPY ./v6_wrapper/ncdc_maastricht_wrapper/tasks_manager.py /mnt/temporary/tasks_manager.py
# Execute the docker wrapper when running the image
CMD python -c "from federated_brain_age.docker_wrapper_v6 import docker_wrapper; docker_wrapper('${PKG_NAME}')"