A (very) simple, text only chatbot using Society AI inference endpoint

Update .gitea/workflows/gradio-text-chatbot.yaml
All checks were successful
society-ai-hub-container-cache Actions Demo / build (push) Successful in 26s

This commit is contained in:
Hezi Aharon 2024-11-02 06:37:50 +00:00
parent de8c208c06
commit 89e699cb56

@ -1,32 +1,43 @@
# Use a slim base image to reduce potential vulnerabilities
FROM python:3.10-slim-bookworm
name: society-ai-hub-container-cache Actions Demo
run-name: ${{ society-ai-hub-container-cache.actor }} is building an AI Application 🚀
on:
repository_dispatch:
types:
- created
# Create a non-root user and group with home directory set to /usr/src/app
RUN useradd --no-log-init -r -m -d /usr/src/app appuser
push:
branches:
- main
# Set the working directory
WORKDIR /usr/src/app
# Copy the requirements file and install the dependencies as root
COPY requirements.txt .
RUN pip install --no-cache-dir uv==0.4.28 && \
pip install --no-cache-dir -r requirements.txt
# Copy the application code and set ownership to appuser
COPY . .
# Change ownership of the application directory to appuser
RUN chown -R appuser:appuser /usr/src/app
# Switch to the non-root user
USER appuser
# Expose the application port
EXPOSE 7860
# Set environment variables
ENV GRADIO_SERVER_NAME="0.0.0.0"
# Run the application
CMD ["python", "app.py"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Login to ECR
uses: docker/login-action@v3
with:
registry: ${{ vars.ECR_REGISTRY }}
- name: configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
- name: Set up QEMU
uses: https://github.com/actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
platforms: "linux/amd64"
tags: "${{ vars.ECR_REGISTRY }}/gradio-app:${{ env.REPOSITORY_UUID }}"
# cache-from: type=s3,region=${{ vars.AWS_REGION }},bucket=society-ai-hub-container-cache,mode=max
# cache-to: type=s3,region=${{ vars.AWS_REGION }},bucket=society-ai-hub-container-cache,mode=max,compress=true
cache-from: type=local,src=/tmp/
cache-to: type=local,dest=/tmp/
- name: Deploy App
run: |
helm -n default upgrade --install ${{ env.REPOSITORY_UUID }} /charts/gradio-app --set imageDigest=${{ steps.docker_build.outputs.digest }} --set uuid=${{ env.REPOSITORY_UUID }}