优化Docker中的uv逻辑

This commit is contained in:
puke
2025-11-05 10:43:50 +08:00
parent 9201bc0110
commit a312f7c0d8
2 changed files with 7 additions and 5 deletions

View File

@@ -20,14 +20,16 @@ RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*
# 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" && \
uv --version
ENV PATH="/root/.cargo/bin:$PATH"
# Copy dependency files first for better layer caching
COPY pyproject.toml uv.lock ./
# Install Python dependencies using uv
RUN uv sync --frozen --no-dev
RUN /root/.cargo/bin/uv sync --frozen --no-dev
# Copy application code
COPY pixelle_video ./pixelle_video
@@ -50,5 +52,5 @@ ENV CHROME_BIN=/usr/bin/chromium
EXPOSE 8000 8501
# Default command (can be overridden in docker-compose)
CMD ["uv", "run", "python", "api/app.py"]
CMD ["/root/.cargo/bin/uv", "run", "python", "api/app.py"]

View File

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