-
Notifications
You must be signed in to change notification settings - Fork 22
29 lines (27 loc) · 958 Bytes
/
cd_ws.yml
File metadata and controls
29 lines (27 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
name: Deploy the websocket server
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile.websocket
push: true
tags: coderomm/collabydraw-websocket:${{ github.sha }}
- name: Deploy to the VM
run: |
echo "${{ secrets.SSH_PRIVATE_KEY }}" &> ~/ssh_key
chmod 700 /home/runner/ssh_key
ssh -o StrictHostKeyChecking=no -i ~/ssh_key root@64.227.169.180 -t "docker stop user_backend && docker run --name user_backend -d -p 8080:8080 coderomm/collabydraw-websocket:${{ github.sha }}"