Skip to content

Commit

Permalink
Merge pull request #713 from jembi/CU-86c0ghd0t_Fix-CICD-pipeline-for…
Browse files Browse the repository at this point in the history
…-Microfrontend-Releases

Fix ci process for tags and remove AWS deploy
  • Loading branch information
drizzentic authored Nov 5, 2024
2 parents 76b4d3f + bb2d6e9 commit dcdd0eb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 28 deletions.
16 changes: 1 addition & 15 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,4 @@ jobs:
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
run: docker push ${{ env.IMAGE_ID }}
29 changes: 17 additions & 12 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [16]

steps:
- uses: actions/checkout@v2
Expand All @@ -26,15 +26,20 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: jembi/openhim-console:${{ env.RELEASE_VERSION }}
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 ${{ env.RELEASE_VERSION }}
- name: Docker Push
run: docker push ${{ env.IMAGE_ID }}
5 changes: 4 additions & 1 deletion packaging/import-maps-server/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
export DOCKERFILE_VERSION=main

# Push vars. Each deployed environment has its own docker tag
export ENVIRONMENT_NAME=v2.0.0-alpha.2
export DOCKER_ORG_NAME=jembi
PROJECT_UNIQUE_HASH_VERSION=$(git rev-parse HEAD)
export PROJECT_UNIQUE_HASH_VERSION
Expand Down Expand Up @@ -55,6 +54,10 @@ for package in "packages"/*; do
done
cd packaging/import-maps-server/ || exit

# Get environment name from first parameter or use default
ENVIRONMENT_NAME=${1:-poc-microfrontend}
export ENVIRONMENT_NAME

docker build -f Dockerfile-mf --progress=plain --no-cache . -t $DOCKER_ORG_NAME/openhim-console:$ENVIRONMENT_NAME --build-arg WORK_DIR=$(pwd) --build-arg sourceDir=$(pwd)/packaging --build-arg libVersion=$PROJECT_UNIQUE_HASH_VERSION --build-arg baseImage=singlespa/import-maps-mfe-server

echo "IMAGE_ID=$DOCKER_ORG_NAME/openhim-console:$ENVIRONMENT_NAME" >>"$GITHUB_ENV"
Expand Down

0 comments on commit dcdd0eb

Please sign in to comment.