-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (30 loc) · 1.05 KB
/
BackEnd_CD_PROD.yml
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
30
31
32
33
34
35
36
name: BackEnd-CD
on:
push:
branches:
- release
tags:
- 'v*'
jobs:
deploy:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ${{ secrets.NCP_CONTAINER_REGISTRY_PROD }}
username: ${{ secrets.NCP_ACCESS_KEY }}
password: ${{ secrets.NCP_SECRET_KEY }}
- uses: docker/build-push-action@v3
with:
context: .
file: ./BackEnd/Dockerfile
push: true
tags: ${{ secrets.NCP_CONTAINER_REGISTRY_PROD }}/my-app:${{ github.ref_name }}
platforms: linux/amd64
- name: SSH to Internal Server and Deploy
run: |
sshpass -p ${{ secrets.BASTION_PASSWORD_PROD }} ssh -o StrictHostKeyChecking=no ${{ secrets.BASTION_USER_PROD }}@${{ secrets.BASTION_HOST_PROD }} -tt "
docker service update --force --with-registry-auth --image ${{ secrets.NCP_CONTAINER_REGISTRY_PROD }}/my-app:${{ github.ref_name }} my-app
"