-
Notifications
You must be signed in to change notification settings - Fork 29
58 lines (50 loc) · 1.83 KB
/
master.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
57
58
name: Push OpenHIM Console Docker Image On Commit To Master
on:
push:
branches:
- poc-microfrontends
workflow_dispatch:
jobs:
build:
environment: openhim-console
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16]
steps:
- uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Run enc script file
run: node -v && npm -v
shell: bash
- name: Run script file
env:
HOST: ${{ secrets.HOST }}
working-directory: ./packaging/import-maps-server
run: |
chmod +x ./build.sh
./build.sh
- name: Docker Push
run: docker push $IMAGE_ID
- name: Set permissions for private key
run: |
echo "${{ secrets.AWS_PRIVATE_KEY }}" > key.pem
chmod 600 key.pem
- name: Pull Docker image
run: |
ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@${{ secrets.HOST }} 'sudo docker pull' $IMAGE_ID
- name: Stop running container
run: |
ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@${{ secrets.HOST }} 'sudo docker stop jembi-mfe-server || true'
ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@${{ secrets.HOST }} 'sudo docker rm jembi-mfe-server || true'
- name: Run new container
run: |
ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@${{ secrets.HOST }} 'sudo docker run -d --name jembi-mfe-server -p 80:80' -v /home/ubuntu/openhim-console/default.json:/usr/share/nginx/html/config/default.json $IMAGE_ID