File size: 1,399 Bytes
67c46fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7562f2a
ed26be9
1a59bbb
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
FROM nvidia/cuda:12.1.0-base-ubuntu20.04

ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
    && echo $TZ > /etc/timezone

RUN apt-get update \
    && apt-get install -y build-essential \
    && apt-get install -y wget \
    && apt-get install -y software-properties-common curl zip unzip git-lfs awscli libssl-dev openssh-server vim \
    && apt-get install -y net-tools iputils-ping iproute2

RUN apt-get install --reinstall ca-certificates && update-ca-certificates

RUN add-apt-repository -y 'ppa:deadsnakes/ppa' && apt update
RUN apt install python3.10 python3.10-dev python3.10-distutils python3.10-venv -y \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

RUN wget -qO- https://bootstrap.pypa.io/get-pip.py | python3.10
RUN ln -s /usr/bin/python3.10 /usr/bin/python
RUN pip uninstall -y Pillow && pip install pillow

# https://huggingface.co/docs/hub/spaces-sdks-docker#permissions
RUN useradd -m -u 1000 user
USER user

ENV HOME="/home/user" \
    PATH="/home/user/.local/bin:${PATH}"

RUN python3.10 -m pip install pipx
RUN pipx install poetry

RUN poetry --version || { echo 'Poetry installation check failed' ; exit 1; }

WORKDIR /workspace

COPY --chown=user requirements.txt .
RUN pip install -r requirements.txt

COPY --chown=user . .

RUN pip install gradio
RUN pip install openai
RUN chmod +x start_app.sh
CMD ["./start_app.sh", "/tmp/hf_model"]