From 6369c75b10a186e6ebea2a725621242d6b4b40f0 Mon Sep 17 00:00:00 2001 From: mudler Date: Tue, 2 May 2023 20:07:16 +0200 Subject: [PATCH] ci: add workflow --- .github/workflows/image.yml | 78 +++++++++++++++++++++++++++++++++++++ dockerfile => Dockerfile | 0 sample-docker-compose.yml | 9 ++--- src/ChatGptInterface.js | 2 +- 4 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/image.yml rename dockerfile => Dockerfile (100%) diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml new file mode 100644 index 0000000..bc9b28e --- /dev/null +++ b/.github/workflows/image.yml @@ -0,0 +1,78 @@ +--- +name: 'build container images' + +on: + pull_request: + push: + branches: + - master + tags: + - '*' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Prepare + id: prep + run: | + DOCKER_IMAGE=quay.io/go-skynet/localai-frontend + VERSION=master + SHORTREF=${GITHUB_SHA::8} + + # If this is git tag, use the tag name as a docker tag + if [[ $GITHUB_REF == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/} + fi + TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}" + + # If the VERSION looks like a version number, assume that + # this is the most recent version of the image and also + # tag it 'latest'. + if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + TAGS="$TAGS,${DOCKER_IMAGE}:latest" + fi + + # Set output parameters. + echo ::set-output name=tags::${TAGS} + echo ::set-output name=docker_image::${DOCKER_IMAGE} + + - name: Set up QEMU + uses: docker/setup-qemu-action@master + with: + platforms: all + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@master + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + - name: Build + if: github.event_name != 'pull_request' + uses: docker/build-push-action@v4 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.prep.outputs.tags }} + - name: Build PRs + if: github.event_name == 'pull_request' + uses: docker/build-push-action@v4 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./Dockerfile + platforms: linux/amd64 + push: false + tags: ${{ steps.prep.outputs.tags }} diff --git a/dockerfile b/Dockerfile similarity index 100% rename from dockerfile rename to Dockerfile diff --git a/sample-docker-compose.yml b/sample-docker-compose.yml index f13e7d8..4d252e5 100644 --- a/sample-docker-compose.yml +++ b/sample-docker-compose.yml @@ -3,9 +3,6 @@ version: '3.6' services: api: image: quay.io/go-skynet/local-ai:latest - build: - context: . - dockerfile: Dockerfile ports: - 8080:8080 env_file: @@ -15,6 +12,8 @@ services: command: ["/usr/bin/local-ai"] frontend: - image: dhruvgera/localai-frontend:latest + build: + context: . + dockerfile: Dockerfile ports: - - 3000:3000 \ No newline at end of file + - 3000:3000 diff --git a/src/ChatGptInterface.js b/src/ChatGptInterface.js index d5c5229..926aaa5 100644 --- a/src/ChatGptInterface.js +++ b/src/ChatGptInterface.js @@ -151,4 +151,4 @@ const [selectedModel, setSelectedModel] = useState(""); // Added state for selec ); }; -export default ChatGptInterface; +export default ChatGptInterface; \ No newline at end of file