Deploy Actor Image (#34)
This commit is contained in:
parent
c59bb678dd
commit
345b685b08
3 changed files with 136 additions and 2 deletions
106
.github/workflows/release-containers.yml
vendored
Normal file
106
.github/workflows/release-containers.yml
vendored
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
name: Release and Publish Containers
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: 'Version to release (e.g., v1.0.0)'
|
||||||
|
required: true
|
||||||
|
default: 'v1.0.0'
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-and-publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Configure AWS credentials
|
||||||
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
|
with:
|
||||||
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
aws-region: us-east-1
|
||||||
|
|
||||||
|
- name: Login to ECR
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: 471112909428.dkr.ecr.us-east-1.amazonaws.com
|
||||||
|
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
|
||||||
|
- name: Set version
|
||||||
|
id: set_version
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
|
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
|
||||||
|
elif [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
|
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "VERSION=$(date +'%Y.%m.%d')-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build and push Actor image
|
||||||
|
id: build
|
||||||
|
working-directory: ./docker
|
||||||
|
run: |
|
||||||
|
make docker-build VERSION=${{ env.VERSION }}
|
||||||
|
make publish-ecr VERSION=${{ env.VERSION }}
|
||||||
|
echo "image=471112909428.dkr.ecr.us-east-1.amazonaws.com/arcadeai/arcade-ai:${{ env.VERSION }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Deploy to Amazon ECS
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
||||||
|
run: gh workflow -R ArcadeAI/Team run Deploy -f actor-version=${{ env.VERSION }}
|
||||||
|
|
||||||
|
|
||||||
|
- name: Generate release notes
|
||||||
|
id: generate_release_notes
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
run: |
|
||||||
|
echo "Release notes for version ${{ env.VERSION }}" > release_notes.md
|
||||||
|
echo "" >> release_notes.md
|
||||||
|
echo "Changes in this release:" >> release_notes.md
|
||||||
|
git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"- %s" >> release_notes.md
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ env.VERSION }}
|
||||||
|
release_name: Release ${{ env.VERSION }}
|
||||||
|
body_path: release_notes.md
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
|
||||||
|
- name: Upload Release Asset
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./release_notes.md
|
||||||
|
asset_name: release_notes.md
|
||||||
|
asset_content_type: text/markdown
|
||||||
|
|
@ -23,15 +23,24 @@ RUN apt-get update && apt-get install -y \
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN pip install build
|
||||||
|
|
||||||
# Copy the parent directory contents into the container
|
# Copy the parent directory contents into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
WORKDIR /app/arcade
|
||||||
|
|
||||||
|
# Build the project
|
||||||
|
RUN python -m build
|
||||||
|
|
||||||
# Build the project and install the wheel with extras
|
# Build the project and install the wheel with extras
|
||||||
RUN python -m pip install dist/arcade_ai-0.1.0-py3-none-any.whl[fastapi,dev] uvicorn
|
RUN python -m pip install dist/arcade_ai-0.1.0-py3-none-any.whl[fastapi,dev] uvicorn
|
||||||
|
|
||||||
|
WORKDIR /app/toolkits
|
||||||
|
|
||||||
# Install toolkits from the toolkits directory
|
# Install toolkits from the toolkits directory
|
||||||
RUN set -e; \
|
RUN set -e; \
|
||||||
for toolkit in dist/toolkits/*; do \
|
for toolkit in ./*; do \
|
||||||
echo "Installing toolkit $toolkit"; \
|
echo "Installing toolkit $toolkit"; \
|
||||||
pip install $toolkit; \
|
pip install $toolkit; \
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ SOURCE ?= https://github.com/ArcadeAI/arcade-ai
|
||||||
LICENSE ?= MIT
|
LICENSE ?= MIT
|
||||||
DESCRIPTION ?= "Arcade AI for LLM Tool Serving"
|
DESCRIPTION ?= "Arcade AI for LLM Tool Serving"
|
||||||
REPOSITORY ?= arcadeai/arcade-ai
|
REPOSITORY ?= arcadeai/arcade-ai
|
||||||
|
ECR_ENDPOINT ?= 471112909428.dkr.ecr.us-east-1.amazonaws.com
|
||||||
|
|
||||||
VERSION ?= dev
|
VERSION ?= dev
|
||||||
COMMIT ?= $(shell git describe --dirty --always --abbrev=15)
|
COMMIT ?= $(shell git describe --dirty --always --abbrev=15)
|
||||||
|
|
@ -17,7 +18,7 @@ docker-build: ## Build the Docker container
|
||||||
@echo "🛠️ Building Docker image ($(VERSION)).."
|
@echo "🛠️ Building Docker image ($(VERSION)).."
|
||||||
@echo "- Commit: $(COMMIT)"
|
@echo "- Commit: $(COMMIT)"
|
||||||
@echo "- Build Date: $(BUILD_DATE)"
|
@echo "- Build Date: $(BUILD_DATE)"
|
||||||
@docker build --build-arg PORT=$(PORT) -t $(REPOSITORY):$(VERSION) . \
|
@docker build --build-arg PORT=$(PORT) -f Dockerfile -t $(REPOSITORY):$(VERSION) .. \
|
||||||
--build-arg PORT=$(PORT) \
|
--build-arg PORT=$(PORT) \
|
||||||
--build-arg VERSION="$(VERSION)" \
|
--build-arg VERSION="$(VERSION)" \
|
||||||
--build-arg COMMIT="$(COMMIT)" \
|
--build-arg COMMIT="$(COMMIT)" \
|
||||||
|
|
@ -36,6 +37,24 @@ docker-run: ## Run the Docker container
|
||||||
@echo "\n🚀 Run the container with the following ..."
|
@echo "\n🚀 Run the container with the following ..."
|
||||||
@echo ">>> docker run -d -p $(PORT):$(PORT) $(REPOSITORY):$(VERSION)"
|
@echo ">>> docker run -d -p $(PORT):$(PORT) $(REPOSITORY):$(VERSION)"
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: publish-ecr
|
||||||
|
publish-ecr:
|
||||||
|
@echo "🚚 Pushing the Agent image to ECR.."
|
||||||
|
@docker tag $(REPOSITORY):$(VERSION) $(ECR_ENDPOINT)/$(REPOSITORY):$(VERSION)
|
||||||
|
@echo "- pushing $(ECR_ENDPOINT)/$(REPOSITORY):$(VERSION)"
|
||||||
|
@docker push $(ECR_ENDPOINT)/$(REPOSITORY):$(VERSION)
|
||||||
|
@echo $(VERSION) | grep -q $(RC_PART) || { \
|
||||||
|
docker tag $(REPOSITORY):$(VERSION) $(ECR_ENDPOINT)/$(REPOSITORY):latest; \
|
||||||
|
echo "- pushing $(ECR_ENDPOINT)/$(REPOSITORY):latest"; \
|
||||||
|
docker push $(ECR_ENDPOINT)/$(REPOSITORY):latest; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: ecr-login
|
||||||
|
ecr-login: # Login to ECR
|
||||||
|
@aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $(ECR_ENDPOINT)
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
@echo "🛠️ Actor Docker Commands:\n"
|
@echo "🛠️ Actor Docker Commands:\n"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue