Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +15 -8
Dockerfile
CHANGED
@@ -1,10 +1,14 @@
|
|
|
|
|
|
|
|
|
|
1 |
ARG HF_TOKEN
|
2 |
ARG HF_USERNAME
|
|
|
|
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
# Use the correct Hugging Face container
|
7 |
-
FROM registry.hf.space/microsoft-omniparser:latest
|
8 |
|
9 |
# Switch to root user for package installation
|
10 |
USER root
|
@@ -17,11 +21,14 @@ RUN chmod 1777 /tmp \
|
|
17 |
&& apt install -y --no-install-recommends libcudnn8 libcublas-12-2
|
18 |
|
19 |
# Install required Python packages
|
20 |
-
RUN pip install fastapi[all]
|
21 |
|
22 |
-
#
|
23 |
-
|
24 |
WORKDIR /app
|
25 |
|
26 |
-
#
|
|
|
|
|
|
|
27 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
# Set up base image (use the correct Hugging Face registry)
|
2 |
+
FROM registry.huggingface.co/microsoft/omniparser:latest
|
3 |
+
|
4 |
+
# Set environment variables for authentication (persist across layers)
|
5 |
ARG HF_TOKEN
|
6 |
ARG HF_USERNAME
|
7 |
+
ENV HF_TOKEN=${HF_TOKEN}
|
8 |
+
ENV HF_USERNAME=${HF_USERNAME}
|
9 |
|
10 |
+
# Authenticate with Hugging Face's Docker registry
|
11 |
+
RUN echo "$HF_TOKEN" | docker login registry.huggingface.co -u "$HF_USERNAME" --password-stdin
|
|
|
|
|
12 |
|
13 |
# Switch to root user for package installation
|
14 |
USER root
|
|
|
21 |
&& apt install -y --no-install-recommends libcudnn8 libcublas-12-2
|
22 |
|
23 |
# Install required Python packages
|
24 |
+
RUN pip install fastapi[all]
|
25 |
|
26 |
+
# Create the application directory
|
27 |
+
RUN mkdir -p /app
|
28 |
WORKDIR /app
|
29 |
|
30 |
+
# Copy application files
|
31 |
+
COPY main.py /app/main.py
|
32 |
+
|
33 |
+
# Set entry point to run the FastAPI server
|
34 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|