chore(utils): refactor runner test logic to special test cases (#16) #4
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 Base Images | |
on: | |
workflow_dispatch: # Manual trigger | |
push: | |
paths: | |
- "baseImages/**" | |
branches: | |
- main | |
jobs: | |
build-base-images: | |
name: Build Base Images on Droplet | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
image: | |
- { name: "rust", tag: "rs-base", path: "baseImages/rust" } | |
- { | |
name: "typescript", | |
tag: "ts-base", | |
path: "baseImages/typescript", | |
} | |
- { name: "python", tag: "py-base", path: "baseImages/python" } | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Configure SSH | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.STAGING_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan -H ${{ secrets.STAGING_DROPLET_IP }} >> ~/.ssh/known_hosts | |
# Create directory and copy Dockerfile | |
- name: Copy Dockerfile to Droplet | |
run: | | |
ssh ${{ secrets.STAGING_DROPLET_USER }}@${{ secrets.STAGING_DROPLET_IP }} "mkdir -p ~/base-images/${{ matrix.image.name }}" | |
scp ${{ matrix.image.path }}/Dockerfile ${{ secrets.STAGING_DROPLET_USER }}@${{ secrets.STAGING_DROPLET_IP }}:~/base-images/${{ matrix.image.name }}/Dockerfile | |
# Build the image on the droplet | |
- name: Build Base Image | |
run: | | |
ssh ${{ secrets.STAGING_DROPLET_USER }}@${{ secrets.STAGING_DROPLET_IP }} << 'EOF' | |
cd ~/base-images/${{ matrix.image.name }} | |
docker build -t ${{ matrix.image.tag }}:latest . | |
EOF |