Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +31 -31
Dockerfile
CHANGED
|
@@ -1,31 +1,31 @@
|
|
| 1 |
-
FROM python:3.11-slim-bookworm
|
| 2 |
-
|
| 3 |
-
# Set working directory
|
| 4 |
-
WORKDIR /app
|
| 5 |
-
|
| 6 |
-
# Install uv
|
| 7 |
-
RUN pip install --no-cache-dir uv
|
| 8 |
-
|
| 9 |
-
# Copy dependency files
|
| 10 |
-
COPY pyproject.toml uv.lock README.md ./
|
| 11 |
-
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
#
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
# Set environment variables
|
| 21 |
-
# Add the virtual environment to PATH
|
| 22 |
-
ENV PATH="/app/.venv/bin:$PATH"
|
| 23 |
-
ENV HOST=0.0.0.0
|
| 24 |
-
ENV PORT=8000
|
| 25 |
-
|
| 26 |
-
# Expose the port (Hugging Face typically uses 7860, local uses 8000)
|
| 27 |
-
ENV PORT=7860
|
| 28 |
-
EXPOSE $PORT
|
| 29 |
-
|
| 30 |
-
# Command to run the application (using shell form to expand variables)
|
| 31 |
-
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port $PORT"]
|
|
|
|
| 1 |
+
FROM python:3.11-slim-bookworm
|
| 2 |
+
|
| 3 |
+
# Set working directory
|
| 4 |
+
WORKDIR /app
|
| 5 |
+
|
| 6 |
+
# Install uv
|
| 7 |
+
RUN pip install --no-cache-dir uv
|
| 8 |
+
|
| 9 |
+
# Copy dependency files
|
| 10 |
+
COPY pyproject.toml uv.lock README.md ./
|
| 11 |
+
|
| 12 |
+
# Copy application code
|
| 13 |
+
COPY app ./app
|
| 14 |
+
|
| 15 |
+
# Install dependencies
|
| 16 |
+
# --frozen: use exact versions from uv.lock
|
| 17 |
+
# --no-dev: do not install development dependencies
|
| 18 |
+
RUN uv sync --frozen --no-dev
|
| 19 |
+
|
| 20 |
+
# Set environment variables
|
| 21 |
+
# Add the virtual environment to PATH
|
| 22 |
+
ENV PATH="/app/.venv/bin:$PATH"
|
| 23 |
+
ENV HOST=0.0.0.0
|
| 24 |
+
ENV PORT=8000
|
| 25 |
+
|
| 26 |
+
# Expose the port (Hugging Face typically uses 7860, local uses 8000)
|
| 27 |
+
ENV PORT=7860
|
| 28 |
+
EXPOSE $PORT
|
| 29 |
+
|
| 30 |
+
# Command to run the application (using shell form to expand variables)
|
| 31 |
+
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port $PORT"]
|