Create Dockerfile
Browse files- Dockerfile +56 -0
    	
        Dockerfile
    ADDED
    
    | @@ -0,0 +1,56 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            # Use the specified Python runtime as a parent image
         | 
| 2 | 
            +
            FROM docker.io/library/python:3.10.13@sha256:d5b1fbbc00fd3b55620a9314222498bebf09c4bf606425bf464709ed6a79f202
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            # Set the working directory in the container
         | 
| 5 | 
            +
            WORKDIR /usr/src/app
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            # Install required packages
         | 
| 8 | 
            +
            RUN apt-get update && apt-get install -y \
         | 
| 9 | 
            +
                gcc-11 \
         | 
| 10 | 
            +
                build-essential \
         | 
| 11 | 
            +
                ffmpeg \
         | 
| 12 | 
            +
                libsm6 \
         | 
| 13 | 
            +
                libxext6 \
         | 
| 14 | 
            +
                curl \
         | 
| 15 | 
            +
                git \
         | 
| 16 | 
            +
                && apt-get clean \
         | 
| 17 | 
            +
                && rm -rf /var/lib/apt/lists/*
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            # Install Node.js and npm
         | 
| 20 | 
            +
            RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
         | 
| 21 | 
            +
                && apt-get install -y nodejs
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            # Set environment variable to use gcc-11
         | 
| 24 | 
            +
            ENV CC=/usr/bin/gcc-11
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            # Copy the current directory contents into the container
         | 
| 27 | 
            +
            COPY . .
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            # Install any needed packages specified in requirements.txt
         | 
| 30 | 
            +
            RUN pip install --no-cache-dir -r requirements.txt
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            # Set the working directory for the GroundingDINO ops
         | 
| 33 | 
            +
            WORKDIR /usr/src/app/models/GroundingDINO/ops
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            # Run the setup script and the test script
         | 
| 36 | 
            +
            RUN python setup.py build install
         | 
| 37 | 
            +
            RUN python test.py # This should result in 6 lines of * True
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            # Install Gradio
         | 
| 40 | 
            +
            RUN pip install gradio
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            # Clone the custom Gradio component repository and build it
         | 
| 43 | 
            +
            WORKDIR /usr/src/app
         | 
| 44 | 
            +
            RUN git clone https://github.com/niki-amini-naieni/gradio-image-prompter-visible-boxes.git \
         | 
| 45 | 
            +
                && cd gradio-image-prompter-visible-boxes \
         | 
| 46 | 
            +
                && npm install \
         | 
| 47 | 
            +
                && npm run build
         | 
| 48 | 
            +
             | 
| 49 | 
            +
            # Change back to the original working directory
         | 
| 50 | 
            +
            WORKDIR /usr/src/app
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            # Expose the port Gradio will run on
         | 
| 53 | 
            +
            EXPOSE 7860
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            # Default command to run the Gradio app
         | 
| 56 | 
            +
            CMD ["python", "app.py"]
         | 
