From 89e699cb56d95bf28798f7f7dfbfa8147dba1f30 Mon Sep 17 00:00:00 2001 From: Hezi Aharon Date: Sat, 2 Nov 2024 06:37:50 +0000 Subject: [PATCH] Update .gitea/workflows/gradio-text-chatbot.yaml --- .gitea/workflows/gradio-text-chatbot.yaml | 71 +++++++++++++---------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/.gitea/workflows/gradio-text-chatbot.yaml b/.gitea/workflows/gradio-text-chatbot.yaml index 5c56d19..ab4c954 100644 --- a/.gitea/workflows/gradio-text-chatbot.yaml +++ b/.gitea/workflows/gradio-text-chatbot.yaml @@ -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 }} \ No newline at end of file