run server #24
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: run server | |
on: | |
workflow_run: | |
workflows: | |
- "release server" | |
types: | |
- completed | |
env: | |
DOCKER_IMAGE: gmlwh124/ajaja:latest | |
SERVER_NAME: ajaja-server | |
jobs: | |
run-server: | |
runs-on: ubuntu-latest | |
steps: | |
- name: pull image and rerun w/ ssh command | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
docker pull ${{ env.DOCKER_IMAGE }} | |
docker ps -aq --filter name=${{ env.SERVER_NAME }} | xargs docker stop | xargs docker rm | |
docker run --name ${{ env.SERVER_NAME }} --restart=always -dp 8080:8080 --network=ajaja-bridge ${{ env.DOCKER_IMAGE }} | |
docker images -q --filter dangling=true | xargs docker rmi |