Merge pull request #2 from emd1tey/develop #14
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: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
tags: | | |
${{ secrets.DOCKER_USER }}/mojo-example-app:${{ github.run_number }} | |
${{ secrets.DOCKER_USER }}/mojo-example-app:latest | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
deploy: | |
needs: build-and-push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Execute SSH command | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
port: ${{ secrets.SERVER_PORT }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd /home/runner/mojo/ | |
wget -nc https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin | |
wget -nc https://huggingface.co/karpathy/tinyllamas/resolve/main/stories42M.bin | |
wget -nc https://huggingface.co/karpathy/tinyllamas/resolve/main/stories110M.bin | |
echo ${{ secrets.DOCKER_TOKEN }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin | |
docker rm -f llama2_mojo || true | |
docker run -d -v /home/runner/mojo:/app/llama -p 127.0.0.1:7860:7860 --name llama2_mojo ${{ secrets.DOCKER_USER }}/mojo-example-app:${{ github.run_number }} |