File size: 1,226 Bytes
1792bb4
4670dfa
 
 
 
 
1792bb4
 
055abc9
 
1792bb4
e198913
4670dfa
 
 
 
 
e198913
 
 
 
 
1792bb4
 
 
e198913
4670dfa
 
 
 
 
 
 
 
e198913
4670dfa
 
 
 
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
# Use a slim Python base image.
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Set Hugging Face cache directory and Gradio temp/flagging dir
ENV HF_HOME=/app/.cache/huggingface
ENV GRADIO_TEMP_DIR=/tmp/gradio_tmp
ENV GRADIO_FLAGGING_DIR=/tmp/gradio_flags

# Install git and build-essential
RUN apt-get update && apt-get install -y \
    git \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Clone the original nanoVLM repository for its model definition files
# This makes the `models` directory from nanoVLM available under /app/nanoVLM
RUN git clone https://github.com/huggingface/nanoVLM.git /app/nanoVLM

# Create the cache and temp directories and make them writable
RUN mkdir -p $HF_HOME $GRADIO_TEMP_DIR $GRADIO_FLAGGING_DIR && \
    chmod -R 777 $HF_HOME $GRADIO_TEMP_DIR $GRADIO_FLAGGING_DIR

# Copy the requirements file first
COPY requirements.txt requirements.txt

# Install Python dependencies
RUN pip install --no-cache-dir --prefer-binary -r requirements.txt

# Copy the application code into the container
COPY app.py app.py

# Expose the port Gradio will run on
EXPOSE 7860

# Set the default command to run the Gradio application
CMD ["python", "-u", "app.py"]