Spaces:
Sleeping
Sleeping
Commit ·
63e6c37
1
Parent(s): 7a979d3
updated
Browse files- Dockerfile +22 -10
Dockerfile
CHANGED
|
@@ -1,22 +1,34 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
-
WORKDIR /app
|
| 3 |
|
| 4 |
-
#
|
|
|
|
|
|
|
|
|
|
| 5 |
RUN apt update && apt install -y wget curl
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
RUN pip install --no-cache-dir -r requirements.txt && \
|
| 10 |
which uvicorn && uvicorn --version
|
| 11 |
|
| 12 |
-
# Copy code and setup
|
| 13 |
-
COPY . .
|
| 14 |
RUN chmod +x ./setup.sh && ./setup.sh
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
EXPOSE 7860
|
| 22 |
|
|
|
|
| 1 |
FROM python:3.11-slim
|
|
|
|
| 2 |
|
| 3 |
+
# Create user with ID 1000 (required for HF Spaces)
|
| 4 |
+
RUN useradd -m -u 1000 user
|
| 5 |
+
|
| 6 |
+
# Install dependencies as root
|
| 7 |
RUN apt update && apt install -y wget curl
|
| 8 |
|
| 9 |
+
# Set up working directory and change ownership
|
| 10 |
+
WORKDIR /app
|
| 11 |
+
RUN chown -R user:user /app
|
| 12 |
+
|
| 13 |
+
# Install Python dependencies
|
| 14 |
+
COPY --chown=user:user requirements.txt .
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt && \
|
| 16 |
which uvicorn && uvicorn --version
|
| 17 |
|
| 18 |
+
# Copy code and setup with proper ownership
|
| 19 |
+
COPY --chown=user:user . .
|
| 20 |
RUN chmod +x ./setup.sh && ./setup.sh
|
| 21 |
|
| 22 |
+
# Switch to user before creating directories
|
| 23 |
+
USER user
|
| 24 |
+
|
| 25 |
+
# Set up Ollama directories with proper permissions
|
| 26 |
+
ENV HOME=/home/user
|
| 27 |
+
ENV OLLAMA_MODELS=/home/user/.ollama
|
| 28 |
+
RUN mkdir -p /home/user/.ollama
|
| 29 |
+
|
| 30 |
+
# Set PATH for user's local bin
|
| 31 |
+
ENV PATH=/home/user/.local/bin:$PATH
|
| 32 |
|
| 33 |
EXPOSE 7860
|
| 34 |
|