-
Notifications
You must be signed in to change notification settings - Fork 125
/
Dockerfile
56 lines (42 loc) · 1.86 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
56
############################################################
# Dockerfile to build KnowLM container images
# Based on Ubuntu
############################################################
# Use the official Ubuntu 20.04 image as your parent image.
FROM ubuntu:22.04
# Set the working directory within your container to /app.
WORKDIR /app
# Let the python output directly show in the terminal without buffering it first.
ENV PYTHONUNBUFFERED=1
# Update the list of packages, then install some necessary dependencies.
RUN apt-get update && apt-get install -y \
wget \
git \
bzip2 \
libglib2.0-0 \
libxext6 \
libsm6 \
libxrender1 \
make\
g++
RUN rm -rf /var/lib/apt/lists/*
# Download and install the latest version of Miniconda to /opt/conda.
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda \
&& rm Miniconda3-latest-Linux-x86_64.sh
# Add Miniconda's binary directory to PATH.
ENV PATH /opt/conda/bin:$PATH
# Use conda to create a new environment named zhixi and install Python 3.9.
RUN conda create -n zhixi python=3.9 -y
# Initialize bash shell so that 'conda activate' can be used immediately.
RUN conda init bash
# Activate the conda environment.
RUN echo "conda activate zhixi" >> ~/.bashrc
ENV PATH /opt/conda/envs/zhixi/bin:$PATH
# Clone the zhixi project from GitHub.
RUN git clone https://github.com/zjunlp/KnowLM.git
# Change the working directory to the newly cloned zhixi project directory.
WORKDIR /app/KnowLM
# Activate the zhixi conda environment and install the Python dependencies listed in requirements.txt.
RUN /bin/bash -c "source ~/.bashrc && pip install torch==1.13.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116"
RUN /bin/bash -c "source ~/.bashrc && pip install -r requirements.txt"