-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (40 loc) · 1.55 KB
/
Dockerfile
File metadata and controls
51 lines (40 loc) · 1.55 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
ARG BASE_IMAGE=ubuntu:20.04
FROM ${BASE_IMAGE}
ENV TZ=Europe/London
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Speed up the build, and avoid unnecessary writes to disk
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
ENV PIPENV_VENV_IN_PROJECT=true PIP_NO_CACHE_DIR=false PIP_DISABLE_PIP_VERSION_CHECK=1
# Install build dependencies
RUN apt-get update && \
apt-get install -y \
git \
g++ \
wget \
unzip \
curl \
make && \
rm -rf /var/lib/apt/lists/*
# Install Micromamba
RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
ENV MAMBA_ROOT_PREFIX=/opt/conda
ENV PATH=/opt/conda/envs/abbfn2/bin:$PATH
# Install conda dependencies
COPY . /app
ARG ACCELERATOR
RUN if [ "${ACCELERATOR}" = "GPU" ]; then \
sed -i 's/jax==/jax[cuda12_pip]==/g' /app/environment.yaml && \
sed -i 's/libtpu_releases\.html/jax_cuda_releases\.html/g' /app/environment.yaml;\
echo " - nvidia-cudnn-cu12==8.9.7.29" >> /app/environment.yaml; fi
RUN if [ "${ACCELERATOR}" = "TPU" ]; then \
sed -i 's/jax==/jax[tpu]==/g' /app/environment.yaml; fi
RUN if [ "${ACCELERATOR}" = "CPU" ]; then \
echo "Building for cpu" ; fi
# Create environment
RUN micromamba create -y --file /app/environment.yaml \
&& micromamba clean --all --yes \
&& find /opt/conda/ -follow -type f -name '*.pyc' -delete
ENV PATH=/opt/conda/envs/abbfn2/bin/:$PATH
ENV LD_LIBRARY_PATH=/opt/conda/envs/abbfn2/lib/:$LD_LIBRARY_PATH
# Create main working folder
WORKDIR /app