优化Docker中的uv逻辑

This commit is contained in:
puke
2025-11-05 10:45:46 +08:00
parent a312f7c0d8
commit 4d08f69a8d
2 changed files with 6 additions and 7 deletions

View File

@@ -21,15 +21,14 @@ RUN apt-get update && apt-get install -y \
# Install uv package manager # Install uv package manager
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \ RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
export PATH="/root/.cargo/bin:$PATH" && \ /root/.local/bin/uv --version
uv --version ENV PATH="/root/.local/bin:$PATH"
ENV PATH="/root/.cargo/bin:$PATH"
# Copy dependency files first for better layer caching # Copy dependency files first for better layer caching
COPY pyproject.toml uv.lock ./ COPY pyproject.toml uv.lock ./
# Install Python dependencies using uv # Install Python dependencies using uv
RUN /root/.cargo/bin/uv sync --frozen --no-dev RUN /root/.local/bin/uv sync --frozen --no-dev
# Copy application code # Copy application code
COPY pixelle_video ./pixelle_video COPY pixelle_video ./pixelle_video
@@ -52,5 +51,5 @@ ENV CHROME_BIN=/usr/bin/chromium
EXPOSE 8000 8501 EXPOSE 8000 8501
# Default command (can be overridden in docker-compose) # Default command (can be overridden in docker-compose)
CMD ["/root/.cargo/bin/uv", "run", "python", "api/app.py"] CMD ["/root/.local/bin/uv", "run", "python", "api/app.py"]

View File

@@ -7,7 +7,7 @@ services:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: pixelle-video-api container_name: pixelle-video-api
command: /root/.cargo/bin/uv run python api/app.py --host 0.0.0.0 --port 8000 command: /root/.local/bin/uv run python api/app.py --host 0.0.0.0 --port 8000
ports: ports:
- "8000:8000" - "8000:8000"
volumes: volumes:
@@ -42,7 +42,7 @@ services:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: pixelle-video-web container_name: pixelle-video-web
command: /root/.cargo/bin/uv run streamlit run web/app.py --server.port 8501 --server.address 0.0.0.0 command: /root/.local/bin/uv run streamlit run web/app.py --server.port 8501 --server.address 0.0.0.0
ports: ports:
- "8501:8501" - "8501:8501"
volumes: volumes: