-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.53 KB
/
cd-clientes-qa.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
49
50
51
52
53
54
55
56
name: CD-CLIENTES-QA
on:
workflow_dispatch:
env:
SSH_PRIVATE_KEY: ${{ secrets.PEM_CLIENTES_QA }}
REMOTE_USER: ec2-user
REMOTE_HOST: ${{ secrets.IP_CLIENTES_QA }}
APP_NAME: app.js
DOCKERHUB_TOKEN: ${{ secrets.DH_TOKEN_CLIENTES }}
DOCKERHUB_USERNAME: romicalani
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Iniciar sesion en Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}
- name: Generar imagen Docker
run: |
docker build . -t ${{env.DOCKERHUB_USERNAME }}/node-app:latest
- name: Subir imagen Docker
run: |
docker push ${{env.DOCKERHUB_USERNAME }}/node-app:latest
- name: Instalar docker
uses: appleboy/ssh-action@master
with:
host: ${{ env.REMOTE_HOST }}
username: ${{ env.REMOTE_USER }}
key: ${{ env.SSH_PRIVATE_KEY }}
script: |
if ! command -v docker > /dev/null; then
sudo yum install docker
else
echo "docker is installed."
fi
- name: Descargar imagen docker
uses: appleboy/ssh-action@master
with:
host: ${{ env.REMOTE_HOST }}
username: ${{ env.REMOTE_USER }}
key: ${{ env.SSH_PRIVATE_KEY }}
script: |
docker pull ${{env.DOCKERHUB_USERNAME }}/node-app:latest
docker run -dp 3000:3000 ${{env.DOCKERHUB_USERNAME }}/node-app:latest