gpu amd 64
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
# Dockerfile.gpu - CUDA-enabled PaddleOCR REST API
|
||||
#
|
||||
# Supports:
|
||||
# - x86_64: Uses prebuilt paddlepaddle-gpu wheel from PyPI
|
||||
# - ARM64: Uses locally compiled wheel from ./wheels/ directory
|
||||
# Supports both architectures:
|
||||
# - x86_64: Uses paddlepaddle-gpu from PaddlePaddle's CUDA index
|
||||
# - ARM64: Uses local wheel from ./wheels/ (built on DGX Spark)
|
||||
#
|
||||
# For ARM64, first build the wheel:
|
||||
# docker compose run build-paddle
|
||||
# For ARM64 (DGX Spark), first build the wheel:
|
||||
# docker compose --profile build run --rm build-paddle
|
||||
# Then build this image:
|
||||
# docker compose build ocr-gpu
|
||||
#
|
||||
# See README.md for detailed ARM64 GPU build instructions.
|
||||
# For x86_64, just build directly (no wheel needed):
|
||||
# docker compose build ocr-gpu
|
||||
|
||||
FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04
|
||||
|
||||
@@ -37,31 +38,25 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& ln -sf /usr/bin/python3.11 /usr/bin/python
|
||||
|
||||
# Copy local wheels directory (may be empty or contain ARM64 wheel)
|
||||
# The wheels/ directory is created by: docker compose run build-paddle
|
||||
# Copy local wheels directory (may contain ARM64 wheel from build-paddle)
|
||||
COPY wheels/ /tmp/wheels/
|
||||
|
||||
# Install Python dependencies
|
||||
# Strategy:
|
||||
# 1. If local paddlepaddle wheel exists (ARM64), install it first
|
||||
# 2. Then install remaining dependencies (excluding paddlepaddle-gpu from requirements)
|
||||
# Copy requirements
|
||||
COPY requirements-gpu.txt .
|
||||
|
||||
# Install paddlepaddle: prefer local wheel, fallback to pip
|
||||
# Install paddlepaddle: prefer local wheel (ARM64), fallback to CUDA index (x86_64)
|
||||
RUN if ls /tmp/wheels/paddlepaddle*.whl 1>/dev/null 2>&1; then \
|
||||
echo "=== Installing PaddlePaddle from local wheel (ARM64) ===" && \
|
||||
pip install --no-cache-dir /tmp/wheels/paddlepaddle*.whl; \
|
||||
else \
|
||||
echo "=== Installing PaddlePaddle from PyPI (x86_64) ===" && \
|
||||
pip install --no-cache-dir paddlepaddle-gpu==3.0.0; \
|
||||
echo "=== Installing PaddlePaddle from CUDA index (x86_64) ===" && \
|
||||
pip install --no-cache-dir paddlepaddle-gpu==3.2.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/; \
|
||||
fi
|
||||
|
||||
# Install remaining dependencies (skip paddlepaddle-gpu line)
|
||||
# Install remaining dependencies (skip paddlepaddle-gpu line from requirements)
|
||||
RUN grep -v "paddlepaddle-gpu" requirements-gpu.txt > /tmp/requirements-no-paddle.txt && \
|
||||
pip install --no-cache-dir -r /tmp/requirements-no-paddle.txt
|
||||
|
||||
# Cleanup
|
||||
RUN rm -rf /tmp/wheels /tmp/requirements-no-paddle.txt
|
||||
pip install --no-cache-dir -r /tmp/requirements-no-paddle.txt && \
|
||||
rm -rf /tmp/wheels /tmp/requirements-no-paddle.txt
|
||||
|
||||
# Copy application code
|
||||
COPY paddle_ocr_tuning_rest.py .
|
||||
|
||||
Reference in New Issue
Block a user