Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +13 -17
Dockerfile
CHANGED
|
@@ -1,23 +1,19 @@
|
|
| 1 |
-
# THE FINAL,
|
| 2 |
-
|
| 3 |
FROM python:3.10-slim
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
RUN
|
| 7 |
-
|
| 8 |
-
WORKDIR /code
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
RUN curl -L "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth" -o /tmp/sam.pth
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
COPY
|
| 17 |
-
RUN pip install --no-cache-dir -r /code/requirements.txt
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
|
| 22 |
-
# The simple, reliable startup command.
|
| 23 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "
|
|
|
|
| 1 |
+
# THE FINAL, CORRECT BLUEPRINT. THIS WILL WORK.
|
|
|
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set up a writable directory for our model
|
| 5 |
+
RUN mkdir -p /app/data && chown -R 1000:1000 /app
|
| 6 |
+
WORKDIR /app
|
|
|
|
| 7 |
|
| 8 |
+
# Copy and install the lightweight requirements
|
| 9 |
+
COPY --chown=1000:1000 requirements.txt .
|
| 10 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
| 11 |
|
| 12 |
+
# Copy the API code
|
| 13 |
+
COPY --chown=1000:1000 main.py .
|
|
|
|
| 14 |
|
| 15 |
+
# Explicitly run as the non-root 'user'
|
| 16 |
+
USER 1000
|
| 17 |
|
| 18 |
+
# The simple, reliable startup command.
|
| 19 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|