Skip to content

Improvement: Add IResultAction controller action to SearchStudent, (n… #22

Improvement: Add IResultAction controller action to SearchStudent, (n…

Improvement: Add IResultAction controller action to SearchStudent, (n… #22

name: Backend CI/CD
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.x'
include-prerelease: true
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Publish to output directory
run: dotnet publish -c Release -o ./output
- name: Build Docker image
run: docker build -t martian0x80/ipusenpai:latest .
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Push Docker image to registry
run: docker push martian0x80/ipusenpai:latest
deploy-to-server:
runs-on: ubuntu-latest
needs: build-and-push
steps:
- name: SSH
uses: appleboy/[email protected]
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_KEY }}
port: ${{ secrets.REMOTE_PORT }}
script: |
echo "Pruning images..." | cowsay | lolcat
docker image prune
echo "Pulling Docker Image..." | cowsay | lolcat
docker pull martian0x80/ipusenpai:latest
echo "Killing em all..." | cowsay | lolcat
#docker rm $(docker stop $(docker ps -a -q --filter ancestor=martian0x80/ipusenpai --format="{{.ID}}"))
docker system prune -f
echo "Running Docker Container..." | cowsay | lolcat
#docker run -d -p 80:8080 --env-file ~/.env martian0x80/ipusenpai:latest
docker-compose up -d
echo "Pipeline completed." | cowsay | lolcat