fix: modify docker image CICD

fix: Fix error CICD config

fix: Fix docker image error

fix: Reduce docker image size

fix: remove other architecture

fix: remove llama.cpp dependencies from base image
This commit is contained in:
FangYin Cheng 2023-08-18 17:42:16 +08:00
parent 076e22a5a5
commit b5f2758dc0
3 changed files with 51 additions and 47 deletions

View File

@ -0,0 +1,35 @@
name: Push docker image
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
jobs:
build-image:
runs-on: ubuntu-latest
# run unless event type is pull_request
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/base/Dockerfile
platforms: linux/amd64
push: true
tags: eosphorosai/dbgpt:${{ github.ref_name }}

View File

@ -35,27 +35,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
build-image:
runs-on: ubuntu-latest
needs: deploy
# run unless event type is pull_request
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: eosphorosai/dbgpt:${{ github.ref_name }}
password: ${{ secrets.PYPI_API_TOKEN }}

View File

@ -1,4 +1,4 @@
ARG BASE_IMAGE="nvidia/cuda:11.8.0-devel-ubuntu22.04"
ARG BASE_IMAGE="nvidia/cuda:11.8.0-runtime-ubuntu22.04"
FROM ${BASE_IMAGE}
ARG BASE_IMAGE
@ -11,16 +11,6 @@ ARG LANGUAGE="en"
ARG PIP_INDEX_URL="https://pypi.org/simple"
ENV PIP_INDEX_URL=$PIP_INDEX_URL
RUN pip3 install --upgrade pip -i $PIP_INDEX_URL \
&& (if [ "${LANGUAGE}" = "zh" ]; \
# language is zh, download zh_core_web_sm from github
then wget https://github.com/explosion/spacy-models/releases/download/zh_core_web_sm-3.5.0/zh_core_web_sm-3.5.0-py3-none-any.whl -O /tmp/zh_core_web_sm-3.5.0-py3-none-any.whl \
&& pip3 install /tmp/zh_core_web_sm-3.5.0-py3-none-any.whl -i $PIP_INDEX_URL \
&& rm /tmp/zh_core_web_sm-3.5.0-py3-none-any.whl; \
# not zh, download directly
else python3 -m spacy download zh_core_web_sm; \
fi;)
RUN mkdir -p /app
# COPY only requirements.txt first to leverage Docker cache
@ -30,20 +20,22 @@ COPY ./README.md /app/README.md
WORKDIR /app
# RUN pip3 install --upgrade pip -i $PIP_INDEX_URL \
# && (if [ "${BUILD_LOCAL_CODE}" = "false" ]; \
# # if not build local code, clone latest code from git, and rename to /app, TODO: download by version, like: https://github.com/eosphoros-ai/DB-GPT/archive/refs/tags/$DBGPT_VERSION.zip
# then git clone https://github.com/eosphoros-ai/DB-GPT.git /app \
# && cp /app/requirements.txt /tmp/requirements.txt; \
# fi;) \
# && pip3 install -r /tmp/requirements.txt -i $PIP_INDEX_URL --no-cache-dir \
# && rm /tmp/requirements.txt
RUN pip3 install -i $PIP_INDEX_URL .
# ENV CMAKE_ARGS="-DLLAMA_CUBLAS=ON -DLLAMA_AVX2=OFF -DLLAMA_F16C=OFF -DLLAMA_FMA=OFF"
# ENV FORCE_CMAKE=1
RUN pip3 install -i $PIP_INDEX_URL .[llama_cpp] \
# Install all
# RUN pip3 install -i $PIP_INDEX_URL ".[all]"
RUN pip3 install --upgrade pip -i $PIP_INDEX_URL \
&& pip3 install -i $PIP_INDEX_URL . \
# && pip3 install -i $PIP_INDEX_URL ".[llama_cpp]" \
&& (if [ "${LANGUAGE}" = "zh" ]; \
# language is zh, download zh_core_web_sm from github
then wget https://github.com/explosion/spacy-models/releases/download/zh_core_web_sm-3.5.0/zh_core_web_sm-3.5.0-py3-none-any.whl -O /tmp/zh_core_web_sm-3.5.0-py3-none-any.whl \
&& pip3 install /tmp/zh_core_web_sm-3.5.0-py3-none-any.whl -i $PIP_INDEX_URL \
&& rm /tmp/zh_core_web_sm-3.5.0-py3-none-any.whl; \
# not zh, download directly
else python3 -m spacy download zh_core_web_sm; \
fi;) \
&& rm -rf `pip3 cache dir`
ARG BUILD_LOCAL_CODE="false"