Merge pull request #678 from jembi/feature/CI-86c082m9k_channels-fixes #68
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |