update workflow #8
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 on EC2 Instance | |
on: | |
push: | |
branches: | |
- feat/deploy | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: SSH and Execute Build on EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: 44.197.101.62 | |
username: ubuntu # Usually 'ubuntu' or 'ec2-user' | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
whoami | |
ls -al | |
git clone https://github.com/OpenAdaptAI/SoM | |
cd SoM | |
# Login to AWS ECR | |
$(aws ecr get-login --no-include-email --region us-east-1) | |
# Build the image | |
sudo docker build -t openadapt . | |
#sudo docker run -d -p 80:80 openadapt | |
# Tag the image for the ECR repository | |
docker tag openadapt:latest 726461418004.dkr.ecr.us-east-1.amazonaws.com/openadapt:latest | |
# Push the image to ECR | |
docker push 726461418004.dkr.ecr.us-east-1.amazonaws.com/openadapt:latest |