mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-04-13 09:39:17 +00:00
Multiarch support
This commit is contained in:
parent
44724b2035
commit
31b5e33408
3 changed files with 22 additions and 23 deletions
|
@ -9,25 +9,28 @@ REGISTRY="ghcr.io"
|
||||||
OWNER="remsky"
|
OWNER="remsky"
|
||||||
REPO="kokoro-fastapi"
|
REPO="kokoro-fastapi"
|
||||||
|
|
||||||
# Build CPU image
|
# Create and use a new builder that supports multi-platform builds
|
||||||
echo "Building CPU image..."
|
docker buildx create --name multiplatform-builder --use || true
|
||||||
docker build -t ${REGISTRY}/${OWNER}/${REPO}-cpu:${VERSION} -f docker/cpu/Dockerfile .
|
|
||||||
docker tag ${REGISTRY}/${OWNER}/${REPO}-cpu:${VERSION} ${REGISTRY}/${OWNER}/${REPO}-cpu:latest
|
|
||||||
|
|
||||||
# Build GPU image
|
# Build CPU image with multi-platform support
|
||||||
|
echo "Building CPU image..."
|
||||||
|
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||||
|
-t ${REGISTRY}/${OWNER}/${REPO}-cpu:${VERSION} \
|
||||||
|
-t ${REGISTRY}/${OWNER}/${REPO}-cpu:latest \
|
||||||
|
-f docker/cpu/Dockerfile \
|
||||||
|
--push .
|
||||||
|
|
||||||
|
# Build GPU image with multi-platform support
|
||||||
echo "Building GPU image..."
|
echo "Building GPU image..."
|
||||||
docker build -t ${REGISTRY}/${OWNER}/${REPO}-gpu:${VERSION} -f docker/gpu/Dockerfile .
|
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||||
docker tag ${REGISTRY}/${OWNER}/${REPO}-gpu:${VERSION} ${REGISTRY}/${OWNER}/${REPO}-gpu:latest
|
-t ${REGISTRY}/${OWNER}/${REPO}-gpu:${VERSION} \
|
||||||
|
-t ${REGISTRY}/${OWNER}/${REPO}-gpu:latest \
|
||||||
|
-f docker/gpu/Dockerfile \
|
||||||
|
--push .
|
||||||
|
|
||||||
echo "Build complete!"
|
echo "Build complete!"
|
||||||
echo "Created images:"
|
echo "Created images:"
|
||||||
echo "- ${REGISTRY}/${OWNER}/${REPO}-cpu:${VERSION}"
|
echo "- ${REGISTRY}/${OWNER}/${REPO}-cpu:${VERSION} (linux/amd64, linux/arm64)"
|
||||||
echo "- ${REGISTRY}/${OWNER}/${REPO}-cpu:latest"
|
echo "- ${REGISTRY}/${OWNER}/${REPO}-cpu:latest (linux/amd64, linux/arm64)"
|
||||||
echo "- ${REGISTRY}/${OWNER}/${REPO}-gpu:${VERSION}"
|
echo "- ${REGISTRY}/${OWNER}/${REPO}-gpu:${VERSION} (linux/amd64, linux/arm64)"
|
||||||
echo "- ${REGISTRY}/${OWNER}/${REPO}-gpu:latest"
|
echo "- ${REGISTRY}/${OWNER}/${REPO}-gpu:latest (linux/amd64, linux/arm64)"
|
||||||
|
|
||||||
echo -e "\nTo push to GitHub Container Registry:"
|
|
||||||
echo "docker push ${REGISTRY}/${OWNER}/${REPO}-cpu:${VERSION}"
|
|
||||||
echo "docker push ${REGISTRY}/${OWNER}/${REPO}-cpu:latest"
|
|
||||||
echo "docker push ${REGISTRY}/${OWNER}/${REPO}-gpu:${VERSION}"
|
|
||||||
echo "docker push ${REGISTRY}/${OWNER}/${REPO}-gpu:latest"
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM python:3.10-slim
|
FROM --platform=$BUILDPLATFORM python:3.10-slim
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
@ -35,10 +35,6 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
COPY --chown=appuser:appuser api ./api
|
COPY --chown=appuser:appuser api ./api
|
||||||
COPY --chown=appuser:appuser web ./web
|
COPY --chown=appuser:appuser web ./web
|
||||||
|
|
||||||
# Copy project files
|
|
||||||
COPY --chown=appuser:appuser api ./api
|
|
||||||
COPY --chown=appuser:appuser web ./web
|
|
||||||
|
|
||||||
# Install project
|
# Install project
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
uv sync --extra cpu
|
uv sync --extra cpu
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04
|
FROM --platform=$BUILDPLATFORM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04
|
||||||
# Set non-interactive frontend
|
# Set non-interactive frontend
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue