Skip to content

Commit

Permalink
Merge pull request #300 from chemwolf6922/add-minimum-docker-build
Browse files Browse the repository at this point in the history
Add minimum docker build
  • Loading branch information
tjbck authored Oct 23, 2024
2 parents c90e580 + 34a1482 commit 6cdac4f
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 10 deletions.
11 changes: 10 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
.venv
.env
.env
.git
.gitignore
.github
Dockerfile
examples
docs
*.md
dev.sh
dev-docker.sh
19 changes: 19 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
25 changes: 17 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
FROM python:3.11-slim-bookworm AS base

# Use args
ARG MINIMUM_BUILD
ARG USE_CUDA
ARG USE_CUDA_VER

## Basis ##
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 && \
Expand All @@ -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 . .
Expand All @@ -37,4 +46,4 @@ COPY . .
ENV HOST="0.0.0.0"
ENV PORT="9099"

ENTRYPOINT [ "bash", "start.sh" ]
ENTRYPOINT [ "bash", "start.sh" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
File renamed without changes
15 changes: 15 additions & 0 deletions requirements-minimum.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6cdac4f

Please sign in to comment.