-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
55 lines (43 loc) · 1.52 KB
/
Dockerfile
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
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND noninteractive
ENV HOME /root
ENV PYENV_ROOT $HOME/.pyenv
ENV PATH $PYENV_ROOT/bin:$PATH
ARG PYTHON_VERSION="3.10.1"
ARG work_dir="/app"
WORKDIR ${work_dir}
RUN apt update
# Install Python dependencies
RUN apt install -y \
git \
curl \
build-essential \
libbz2-dev \
libdb-dev \
libreadline-dev \
libffi-dev \
libgdbm-dev \
liblzma-dev \
libncursesw5-dev \
libsqlite3-dev \
libssl-dev \
zlib1g-dev \
uuid-dev \
tk-dev
# Install pyenv
RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv
RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc && \
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc && \
echo 'eval "$(pyenv init --path)"' >> ~/.bashrc
RUN eval "$(pyenv init --path)"
# Install and set Python version
RUN pyenv install $PYTHON_VERSION && \
pyenv global $PYTHON_VERSION
# Install poetry
RUN /root/.pyenv/shims/pip install poetry
COPY pyproject.toml* poetry.lock* ./
RUN /root/.pyenv/shims/poetry config virtualenvs.create false
RUN if [ -f pyproject.toml ]; then /root/.pyenv/shims/poetry install --no-root; fi
# Install detectron2 (poetry has some issues with detectron2)
RUN /root/.pyenv/shims/pip install 'git+https://github.com/facebookresearch/detectron2.git'