Skip to content

Use platform specific sdk #43

Use platform specific sdk

Use platform specific sdk #43

Workflow file for this run

name: Build and deploy .NET
on:
push:
branches: [ master ]
jobs:
build-api:
runs-on: self-hosted
env:
DOTNET_INSTALL_DIR: "./.dotnet"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
- name: Build Docker Image
run: |
docker buildx build --platform linux/arm64 -t alenalex/myserve-http-api:master --file Dockerfile-Api .
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Docker Image
run: |
docker push alenalex/myserve-http-api:master
build-consumer-job:
runs-on: self-hosted
env:
DOTNET_INSTALL_DIR: "./.dotnet"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
- name: Build Docker Image
run: |
docker buildx build --platform linux/arm64 -t alenalex/myserve-worker-message-consumer:master --file Dockerfile-Consumer-Job .
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Docker Image
run: |
docker push alenalex/myserve-worker-message-consumer:master
deploy:
runs-on: ubuntu-22.04
needs: ["build-api", "build-consumer-job"]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: "Update docker compose from GitHub"
uses: appleboy/scp-action@master
with:
host: ${{ secrets.VM_HOST }}
username: ${{ secrets.VM_USERNAME }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
source: "docker-compose.yml"
target: "/home/my-serve/"
- name: Deploy to VM
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.VM_HOST }}
username: ${{ secrets.VM_USERNAME }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
script: |
cd /home/my-serve/
docker compose pull
docker compose up -d