diff --git a/.dockerignore b/.dockerignore index c2eabeca..a56310cd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,11 @@ .venv -.env \ No newline at end of file +.env +.git +.gitignore +.github +Dockerfile +examples +docs +*.md +dev.sh +dev-docker.sh diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 5dab1b59..62398b43 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -23,6 +23,16 @@ jobs: extract_flavor: suffix=-cuda,onlatest=true build_args: | USE_CUDA=true + + build-minimum-image: + uses: ./.github/workflows/build-docker-image.yaml + with: + image_name: ${{ github.repository }} + cache_id: minimum + image_tag: type=raw,enable=${{ github.ref == 'refs/heads/main' }},prefix=,suffix=,value=minimum + extract_flavor: suffix=-minimum,onlatest=true + build_args: | + MINIMUM_BUILD=true merge-main-images: uses: ./.github/workflows/merge-docker-images.yaml @@ -39,3 +49,12 @@ jobs: cache_id: cuda extract_flavor: suffix=-cuda,onlatest=true extract_tags: type=raw,enable=${{ github.ref == 'refs/heads/main' }},prefix=,suffix=,value=cuda + + merge-minimum-images: + uses: ./.github/workflows/merge-docker-images.yaml + needs: [build-minimum-image] + with: + image_name: ${{ github.repository }} + cache_id: minimum + extract_flavor: suffix=-minimum,onlatest=true + extract_tags: type=raw,enable=${{ github.ref == 'refs/heads/main' }},prefix=,suffix=,value=minimum diff --git a/Dockerfile b/Dockerfile index 5d2677df..478b6151 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM python:3.11-slim-bookworm AS base # Use args +ARG MINIMUM_BUILD ARG USE_CUDA ARG USE_CUDA_VER @@ -8,11 +9,12 @@ ARG USE_CUDA_VER ENV ENV=prod \ PORT=9099 \ # pass build args to the build + MINIMUM_BUILD=${MINIMUM_BUILD} \ USE_CUDA_DOCKER=${USE_CUDA} \ USE_CUDA_DOCKER_VER=${USE_CUDA_VER} - -# Install GCC and build tools +# Install GCC and build tools. +# These are kept in the final image to enable installing packages on the fly. RUN apt-get update && \ apt-get install -y gcc build-essential curl git && \ apt-get clean && \ @@ -22,13 +24,20 @@ WORKDIR /app # Install Python dependencies COPY ./requirements.txt . -RUN pip3 install uv && \ - if [ "$USE_CUDA" = "true" ]; then \ - pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$USE_CUDA_DOCKER_VER --no-cache-dir; \ +COPY ./requirements-minimum.txt . +RUN pip3 install uv +RUN if [ "$MINIMUM_BUILD" != "true" ]; then \ + if [ "$USE_CUDA_DOCKER" = "true" ]; then \ + pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$USE_CUDA_DOCKER_VER --no-cache-dir; \ + else \ + pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir; \ + fi \ + fi +RUN if [ "$MINIMUM_BUILD" = "true" ]; then \ + uv pip install --system -r requirements-minimum.txt --no-cache-dir; \ else \ - pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir; \ + uv pip install --system -r requirements.txt --no-cache-dir; \ fi -RUN uv pip install --system -r requirements.txt --no-cache-dir # Copy the application code COPY . . @@ -37,4 +46,4 @@ COPY . . ENV HOST="0.0.0.0" ENV PORT="9099" -ENTRYPOINT [ "bash", "start.sh" ] \ No newline at end of file +ENTRYPOINT [ "bash", "start.sh" ] diff --git a/README.md b/README.md index d94e15fc..5e78ab42 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
# Pipelines: UI-Agnostic OpenAI API Plugin Framework diff --git a/header.png b/docs/images/header.png similarity index 100% rename from header.png rename to docs/images/header.png diff --git a/requirements-minimum.txt b/requirements-minimum.txt new file mode 100644 index 00000000..559be6aa --- /dev/null +++ b/requirements-minimum.txt @@ -0,0 +1,15 @@ +fastapi==0.111.0 +uvicorn[standard]==0.22.0 +pydantic==2.7.1 +python-multipart==0.0.9 +python-socketio +grpcio + +passlib==1.7.4 +passlib[bcrypt] +PyJWT[crypto] + +requests==2.32.2 +aiohttp==3.9.5 +httpx +