Skip to content

Commit

Permalink
feat: only keep the build artifacts from the grpc build (#2172)
Browse files Browse the repository at this point in the history
* feat: only keep the build artifacts from the grpc build

Signed-off-by: Chris Jowett <[email protected]>

* feat: remove separate Cache GRPC build step

Signed-off-by: Chris Jowett <[email protected]>

* feat: remove docker inspect step, it is leftover from previous debugging

Signed-off-by: Chris Jowett <[email protected]>

---------

Signed-off-by: Chris Jowett <[email protected]>
  • Loading branch information
cryptk authored Apr 28, 2024
1 parent 21974fe commit 987b7ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 34 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/image_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,26 +201,6 @@ jobs:
username: ${{ secrets.quayUsername }}
password: ${{ secrets.quayPassword }}

- name: Cache GRPC
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
# The build-args MUST be an EXACT match between the image cache and other workflow steps that want to use that cache.
# This means that even the MAKEFLAGS have to be an EXACT match.
# If the build-args are not an EXACT match, it will result in a cache miss, which will require GRPC to be built from scratch.
build-args: |
GRPC_BASE_IMAGE=${{ inputs.grpc-base-image || inputs.base-image }}
GRPC_MAKEFLAGS=--jobs=4 --output-sync=target
GRPC_VERSION=v1.58.0
context: .
file: ./Dockerfile
cache-from: type=gha
target: grpc
platforms: ${{ inputs.platforms }}
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push
uses: docker/build-push-action@v5
with:
Expand Down Expand Up @@ -248,14 +228,6 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Inspect image
if: github.event_name != 'pull_request'
run: |
docker pull localai/localai:${{ steps.meta.outputs.version }}
docker image inspect localai/localai:${{ steps.meta.outputs.version }}
docker pull quay.io/go-skynet/local-ai:${{ steps.meta.outputs.version }}
docker image inspect quay.io/go-skynet/local-ai:${{ steps.meta.outputs.version }}
- name: Build and push AIO image
if: inputs.aio != ''
uses: docker/build-push-action@v5
Expand Down
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,16 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN git clone --recurse-submodules --jobs 4 -b ${GRPC_VERSION} --depth 1 --shallow-submodules https://github.com/grpc/grpc

WORKDIR /build/grpc/cmake/build

# We install GRPC to a different prefix here so that we can copy in only the build artifacts later
# saves several hundred MB on the final docker image size vs copying in the entire GRPC source tree
# and running make install in the target container
RUN cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX:PATH=/opt/grpc ../.. && \
RUN git clone --recurse-submodules --jobs 4 -b ${GRPC_VERSION} --depth 1 --shallow-submodules https://github.com/grpc/grpc && \
mkdir -p /build/grpc/cmake/build && \
cd /build/grpc/cmake/build && \
cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX:PATH=/opt/grpc ../.. && \
make && \
make install
make install && \
rm -rf /build

###################################
###################################
Expand Down

0 comments on commit 987b7ad

Please sign in to comment.