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: | |
command_timeout: "60m" | |
host: 3.84.210.111 | |
username: ubuntu # Usually 'ubuntu' or 'ec2-user' | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
source activate pytorch | |
nvidia-smi | |
git clone https://github.com/OpenAdaptAI/SoM | |
cd SoM | |
git checkout feat/deploy | |
git pull | |
# Stop and remove existing container if it's running | |
sudo docker stop openadapt-container || true | |
sudo docker rm openadapt-container || true | |
# Build the image | |
sudo nvidia-docker build -t openadapt . || exit 1 | |
# Run the image | |
sudo docker run -d -p 6092:6092 --gpus all --name openadapt-container \ | |
-e OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} \ | |
openadapt |