File size: 1,592 Bytes
e20ef71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu20.04

# These are all pre-defined
ENV DEBIAN_FRONTEND=noninteractive \
    TZ=Europe/Paris
# Install some basic utilities
RUN rm -f /etc/apt/sources.list.d/*.list && \
    apt-get update && apt-get install -y --no-install-recommends \
    sudo \
    git \
    curl \
    wget \
    ffmpeg libsm6 libxext6 \
 && rm -rf /var/lib/apt/lists/*
# Create a working directory
WORKDIR /app
# Create a non-root user and switch to it
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
    && chown -R user:user /app \
    && echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
USER user
# All users can use /home/user as their home directory
ENV HOME=/home/user \
    CONDA_AUTO_UPDATE_CONDA=false
ENV PATH=$HOME/miniconda/bin:$PATH
RUN mkdir $HOME/.cache $HOME/.config \
    && chmod -R 777 $HOME \
    && curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py310_24.5.0-0-Linux-x86_64.sh \
    && chmod +x ~/miniconda.sh \
    && ~/miniconda.sh -b -p ~/miniconda \
    && rm ~/miniconda.sh \
    && conda clean -ya

# Python packages
RUN --mount=target=requirements.txt,source=requirements.txt \
    pip install --no-cache-dir torch torchvision && \
    pip install --no-cache-dir git+https://github.com/openai/CLIP.git && \
    pip install --no-cache-dir -r requirements.txt

# Download GLIP dependencies, but unfortunately don't install yet...
RUN git clone https://github.com/sachit-menon/GLIP

# Run gradio
COPY --link --chown=1000 ./ /app
EXPOSE 7860
ENV GRADIO_SERVER_NAME="0.0.0.0"
CMD ["bash", "app.sh"]