Merge pull request #300 from chemwolf6922/add-minimum-docker-build

Add minimum docker build
This commit is contained in:
Timothy Jaeryang Baek 2024-10-23 04:38:42 -07:00 committed by GitHub
commit 6cdac4f4d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 63 additions and 11 deletions

View File

@ -1,2 +1,11 @@
.venv
.env
.env
.git
.gitignore
.github
Dockerfile
examples
docs
*.md
dev.sh
dev-docker.sh

View File

@ -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

View File

@ -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; \
else \
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --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 \
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" ]
ENTRYPOINT [ "bash", "start.sh" ]

View File

@ -1,5 +1,5 @@
<p align="center">
<a href="#"><img src="./header.png" alt="Pipelines Logo"></a>
<a href="#"><img src="./docs/images/header.png" alt="Pipelines Logo"></a>
</p>
# Pipelines: UI-Agnostic OpenAI API Plugin Framework

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

15
requirements-minimum.txt Normal file
View File

@ -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