chore: Update Dockerfile to improve build process and upgrade pip
Browse files- Dockerfile +25 -7
- README.md +2 -0
Dockerfile
CHANGED
@@ -1,21 +1,39 @@
|
|
1 |
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
# you will also find guides on how best to write your Dockerfile
|
3 |
|
|
|
4 |
FROM tiangolo/uvicorn-gunicorn:python3.10-slim
|
5 |
|
6 |
-
# Set
|
7 |
-
|
8 |
|
9 |
-
#
|
10 |
-
|
|
|
11 |
|
12 |
-
#
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
# Upgrade pip
|
16 |
RUN pip install --no-cache-dir --upgrade pip
|
17 |
|
18 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
20 |
|
21 |
# Expose the port the app runs on
|
|
|
1 |
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
# you will also find guides on how best to write your Dockerfile
|
3 |
|
4 |
+
# Use the official Python 3.10 slim image as the base image
|
5 |
FROM tiangolo/uvicorn-gunicorn:python3.10-slim
|
6 |
|
7 |
+
# Set up a new user named "user" with user ID 1000
|
8 |
+
RUN useradd -m -u 1000 user
|
9 |
|
10 |
+
# Create necessary directories and set permissions
|
11 |
+
RUN mkdir -p /home/user/.cache && chown -R user:user /home/user/.cache
|
12 |
+
RUN mkdir -p /home/user/.local && chown -R user:user /home/user/.local
|
13 |
|
14 |
+
# Switch to the "user" user
|
15 |
+
USER user
|
16 |
+
|
17 |
+
# Set home to the user's home directory
|
18 |
+
ENV HOME=/home/user \
|
19 |
+
PATH=/home/user/.local/bin:$PATH
|
20 |
+
|
21 |
+
# Set the working directory to the user's home directory
|
22 |
+
WORKDIR $HOME/app
|
23 |
|
24 |
# Upgrade pip
|
25 |
RUN pip install --no-cache-dir --upgrade pip
|
26 |
|
27 |
+
# Copy the current directory contents into the container at $HOME/app
|
28 |
+
COPY --chown=user . $HOME/app
|
29 |
+
|
30 |
+
# Set the working directory
|
31 |
+
WORKDIR /app
|
32 |
+
|
33 |
+
# List the contents of the working directory to debug
|
34 |
+
RUN ls -la
|
35 |
+
|
36 |
+
# Install the dependencies
|
37 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
38 |
|
39 |
# Expose the port the app runs on
|
README.md
CHANGED
@@ -8,3 +8,5 @@ pinned: false
|
|
8 |
---
|
9 |
|
10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
8 |
---
|
9 |
|
10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
11 |
+
|
12 |
+
SOTA open VLM is [InternVL-1.5](https://huggingface.co/spaces/opencompass/open_vlm_leaderboard), which is 22B, for practical deployment I choose moondream which is a model can answer real-world questions about images (378x378). It's tiny by today's models, with only 1.6B parameters. That enables it to run on a variety of devices, including mobile phones and edge devices.
|