linting #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install AWS CLI | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y awscli | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install git+https://github.com/Rooster-AI/rooster-deepface.git@34702da59c85435e9ce1786bbd27fdf5fde3b822#egg=deepface | |
pip install pylint | |
pip install opencv-python | |
pip install deepface | |
pip install resend | |
pip install supabase | |
pip install python-dotenv | |
- name: Create .env file | |
run: | | |
echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }}" > .env | |
echo "SUPABASE_KEY=${{ secrets.SUPABASE_KEY }}" >> .env | |
echo "RESEND_API_KEY=${{ secrets.RESEND_API_KEY }}" >> .env | |
- name: Build Docker image | |
run: | | |
docker build -t roosteradmin/serverimage:latest . | |
- name: Push Docker image to Docker Hub | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p "${{ secrets.DOCKER_PASSWORD }}" | |
docker push roosteradmin/serverimage:latest | |
- name: Configure AWS credentials | |
run: | | |
aws configure set aws_access_key_id "${{ secrets.AWS_ACCESS_KEY_ID }}" | |
aws configure set aws_secret_access_key "${{ secrets.AWS_SECRET_ACCESS_KEY }}" | |
aws configure set default.region us-west-1 | |
- name: Get Instance ID | |
id: instance | |
run: | | |
INSTANCE_ID=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=rooster-server" --query 'Reservations[*].Instances[*].InstanceId' --output text) | |
echo "::set-output name=instance_id::$INSTANCE_ID" | |
- name: Stop Instance | |
if: steps.instance.outputs.instance_id != '' | |
run: | | |
aws ec2 stop-instances --instance-ids ${{ steps.instance.outputs.instance_id }} | |
aws ec2 wait instance-stopped --instance-ids ${{ steps.instance.outputs.instance_id }} | |
# Add other steps here (e.g., Build and Push Docker image) | |
- name: Start Instance | |
if: steps.instance.outputs.instance_id != '' | |
run: | | |
aws ec2 start-instances --instance-ids ${{ steps.instance.outputs.instance_id }} | |
aws ec2 wait instance-running --instance-ids ${{ steps.instance.outputs.instance_id }} |