Spaces:
Sleeping
Sleeping
Update
Browse files- Dockerfile +8 -15
Dockerfile
CHANGED
@@ -13,7 +13,7 @@ ENV PYTHONUNBUFFERED=1 \
|
|
13 |
UV_CACHE_DIR=/tmp/uv-cache \
|
14 |
PORT=${PORT} \
|
15 |
TRANSPORT_SERVER_URL=${TRANSPORT_SERVER_URL} \
|
16 |
-
HF_HOME=/
|
17 |
|
18 |
# Install system dependencies
|
19 |
RUN apt-get update && apt-get install -y \
|
@@ -36,38 +36,31 @@ RUN apt-get update && apt-get install -y \
|
|
36 |
&& apt-get clean \
|
37 |
&& rm -rf /var/lib/apt/lists/*
|
38 |
|
39 |
-
# Create a non-root user
|
40 |
-
RUN groupadd -r appuser && useradd -r -g appuser -m -s /bin/bash appuser
|
41 |
-
|
42 |
# Set working directory
|
43 |
-
WORKDIR /
|
44 |
|
45 |
# Copy dependency files for better layer caching
|
46 |
-
COPY
|
47 |
|
48 |
# Copy external dependencies (submodules) needed for dependency resolution
|
49 |
-
COPY
|
50 |
|
51 |
# Install dependencies first (better caching)
|
52 |
RUN --mount=type=cache,target=/tmp/uv-cache \
|
53 |
uv sync --locked --no-install-project --no-dev
|
54 |
|
55 |
# Copy the rest of the application
|
56 |
-
COPY
|
57 |
|
58 |
# Install the project in non-editable mode for production
|
59 |
RUN --mount=type=cache,target=/tmp/uv-cache \
|
60 |
uv sync --locked --no-editable --no-dev
|
61 |
|
62 |
-
# Create cache directories for Hugging Face
|
63 |
-
RUN mkdir -p /
|
64 |
-
chown -R appuser:appuser /home/appuser/.cache
|
65 |
-
|
66 |
-
# Switch to non-root user
|
67 |
-
USER appuser
|
68 |
|
69 |
# Add virtual environment to PATH
|
70 |
-
ENV PATH="/
|
71 |
|
72 |
# Expose port (parameterized)
|
73 |
EXPOSE ${PORT}
|
|
|
13 |
UV_CACHE_DIR=/tmp/uv-cache \
|
14 |
PORT=${PORT} \
|
15 |
TRANSPORT_SERVER_URL=${TRANSPORT_SERVER_URL} \
|
16 |
+
HF_HOME=/app/.cache
|
17 |
|
18 |
# Install system dependencies
|
19 |
RUN apt-get update && apt-get install -y \
|
|
|
36 |
&& apt-get clean \
|
37 |
&& rm -rf /var/lib/apt/lists/*
|
38 |
|
|
|
|
|
|
|
39 |
# Set working directory
|
40 |
+
WORKDIR /app
|
41 |
|
42 |
# Copy dependency files for better layer caching
|
43 |
+
COPY pyproject.toml uv.lock* ./
|
44 |
|
45 |
# Copy external dependencies (submodules) needed for dependency resolution
|
46 |
+
COPY external/ ./external/
|
47 |
|
48 |
# Install dependencies first (better caching)
|
49 |
RUN --mount=type=cache,target=/tmp/uv-cache \
|
50 |
uv sync --locked --no-install-project --no-dev
|
51 |
|
52 |
# Copy the rest of the application
|
53 |
+
COPY . .
|
54 |
|
55 |
# Install the project in non-editable mode for production
|
56 |
RUN --mount=type=cache,target=/tmp/uv-cache \
|
57 |
uv sync --locked --no-editable --no-dev
|
58 |
|
59 |
+
# Create cache directories for Hugging Face
|
60 |
+
RUN mkdir -p /app/.cache/hub
|
|
|
|
|
|
|
|
|
61 |
|
62 |
# Add virtual environment to PATH
|
63 |
+
ENV PATH="/app/.venv/bin:$PATH"
|
64 |
|
65 |
# Expose port (parameterized)
|
66 |
EXPOSE ${PORT}
|