-
Notifications
You must be signed in to change notification settings - Fork 25
48 lines (44 loc) · 1.47 KB
/
dev_cd_deploy.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
37
38
39
40
41
42
43
44
45
46
47
48
name: Continuous Integration/ Continuous Deployment
on:
pull_request_target:
types:
- closed
branches: [dev]
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker Login
uses: docker/login-action@v2
with:
username: ${{secrets.DOCKER_USER}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: adding aws credentials
run: sed -i 's|"access_key_id"|"${{secrets.ACCESS_KEY}}"|g;s|"secret_key_id"|"${{secrets.SECRET_KEY}}"|g' dev_index.js
shell: bash
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./dev.Dockerfile
push: true
tags: tibildocker/ingestion_ms:dev
- name: Docker pull image and deploy from hub
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
uses: appleboy/ssh-action@master
with:
HOST: ${{ secrets.DEV_HOST }}
USERNAME: ${{ secrets.USERNAME }}
KEY: ${{ secrets.KEY }}
PORT: '22'
script: |
docker login
docker pull tibildocker/ingestion_ms
docker stop ansible_ingest_app_1 || true
docker rm ansible_ingest_app_1 || true
docker rmi tibildocker/ingestion_ms:dev || true
docker run -d --name ansible_ingest_app_1 -p 3000:3000 --network ansible_cqube_net tibildocker/ingestion_ms:dev