Skip to content

Commit

Permalink
Merge pull request #55 from REAN-Foundation/release/uat-0.2.7
Browse files Browse the repository at this point in the history
Release/uat 0.2.7
  • Loading branch information
kiran-rean authored Sep 11, 2024
2 parents 9bf2b94 + 13aa512 commit 1891102
Show file tree
Hide file tree
Showing 59 changed files with 2,205 additions and 496 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/dev-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

name: Dev-CI-CD

# Controls when the workflow will run
#Controls when the workflow will run
on:
# Triggers the workflow on push events but only for the develop branch
# # Triggers the workflow on push events but only for the develop branch
push:
branches: [develop]

Expand Down Expand Up @@ -62,14 +62,19 @@ jobs:
- name: Copy env file
run: aws s3 cp s3://${{ secrets.ENV_FILE_BUCKET_PATH }}/.env ./.env

- name: Copy constant file
run: aws s3 cp s3://${{ secrets.CONSTANT_FILE_BUCKET_PATH }}/constants.ts ./src/lib

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
build-args: ORIGIN=${{ env.ORIGIN }}
build-args: |
ORIGIN=${{ env.ORIGIN }}
ENVIRONMENT=dev
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/rean-admin-portal:${{ steps.vars.outputs.branch }}_${{ steps.vars.outputs.sha_short }}
cache-from: type=local,src=/tmp/.buildx-cache
Expand Down Expand Up @@ -114,4 +119,4 @@ jobs:
url: 'https://reanfoundation.duplocloud.net/subscriptions/${{ secrets.DUPLO_ID }}/UpdateEcsService'
method: 'POST'
data: '{"TaskDefinition":${{ steps.taskdefintionvar.outputs.task_definition_arn }},"Name": "${{ secrets.SERVICE_NAME }}","Replicas":1, "DnsPrfx": "", "HealthCheckGracePeriodSeconds": 1200}'
bearerToken: ${{ secrets.DUPLOCLOUD_TOKEN }}
bearerToken: ${{ secrets.DUPLOCLOUD_TOKEN_V1 }}
6 changes: 6 additions & 0 deletions .github/workflows/prod-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,19 @@ jobs:
- name: Copy env file
run: aws s3 cp s3://${{ secrets.ENV_FILE_BUCKET_PATH }}/.env ./.env

- name: Copy constant file
run: aws s3 cp s3://${{ secrets.CONSTANT_FILE_BUCKET_PATH }}/constants.ts ./src/lib

- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
build-args: |
ORIGIN=${{ env.ORIGIN }}
ENVIRONMENT=prod
push: true
tags: public.ecr.aws/i9y2d4u3/rean-admin-portal:${{ needs.Publish-Release.outputs.release_name }}_${{ needs.Publish-Release.outputs.release_id }}
cache-from: type=local,src=/tmp/.buildx-cache
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/uat-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
# Triggers the workflow on push events but only for the develop branch

# pull_request:
# branches: main
# branches: main

push:
branches:
Expand Down Expand Up @@ -97,10 +97,13 @@ jobs:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
${{ runner.os }}-buildx-
- name: Copy env file
run: aws s3 cp s3://${{ secrets.ENV_FILE_BUCKET_PATH }}/.env ./.env
run: aws s3 cp s3://${{ secrets.ENV_FILE_BUCKET_PATH }}/.env ./.env

- name: Copy constant file
run: aws s3 cp s3://${{ secrets.CONSTANT_FILE_BUCKET_PATH }}/constants.ts ./src/lib

- name: Build and push
id: docker_build
Expand All @@ -109,7 +112,9 @@ jobs:
context: ./
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
build-args: ORIGIN=${{ env.ORIGIN }}
build-args: |
ORIGIN=${{ env.ORIGIN }}
ENVIRONMENT=uat
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/rean-admin-portal:${{ steps.vars.outputs.branch }}_${{ steps.vars.outputs.sha_short }}
cache-from: type=local,src=/tmp/.buildx-cache
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ RUN npm install
# CMD ["npm", "run", "dev", "--", "--host", "--port", "3000"]
ARG ORIGIN
ENV ORIGIN=${ORIGIN}

ARG ENVIRONMENT
ENV ENVIRONMENT=${ENVIRONMENT}

RUN chmod +x /app/entrypoint.sh
ENTRYPOINT ["/bin/bash", "-c", "/app/entrypoint.sh"]
ENTRYPOINT ["/bin/bash", "-c", "/app/entrypoint.sh $ENVIRONMENT"]

#CMD ["node", "build/index.js"]
45 changes: 38 additions & 7 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
#!/bin/bash
ENVIRONMENT=$1
# Determine the environment and set S3 paths accordingly
case "$ENVIRONMENT" in
"dev")
ENV_FILE_BUCKET="duploservices-dev-configs-new-167414264568/rean-admin-portal"
CONSTANTS_FILE_BUCKET="duploservices-dev-configs-new-167414264568/rean-admin-portal"
FAVICON_FILE_BUCKET="duploservices-dev-configs-new-167414264568/rean-admin-portal"
;;
"uat")
ENV_FILE_BUCKET="duploservices-uat-configs-new-167414264568/rean-admin-portal"
CONSTANTS_FILE_BUCKET="duploservices-uat-configs-new-167414264568/rean-admin-portal"
FAVICON_FILE_BUCKET="duploservices-uat-configs-new-167414264568/rean-admin-portal"
;;
"prod")
ENV_FILE_BUCKET="duploservices-prod-configs-new-167414264568/rean-admin-portal"
CONSTANTS_FILE_BUCKET="duploservices-prod-configs-new-167414264568/rean-admin-portal"
FAVICON_FILE_BUCKET="duploservices-prod-configs-new-167414264568/rean-admin-portal"
;;
"aha-prod")
ENV_FILE_BUCKET="duploservices-ahaprod-configs-167414264568/rean-admin-portal"
CONSTANTS_FILE_BUCKET="duploservices-ahaprod-configs-167414264568/rean-admin-portal"
FAVICON_FILE_BUCKET="duploservices-ahaprod-configs-167414264568/rean-admin-portal"
;;
"aha-uat")
ENV_FILE_BUCKET="duploservices-uat-configs-new-167414264568/rean-admin-portal-aha"
CONSTANTS_FILE_BUCKET="duploservices-uat-configs-new-167414264568/rean-admin-portal-aha"
FAVICON_FILE_BUCKET="duploservices-uat-configs-new-167414264568/rean-admin-portal-aha"
;;
*)
echo "Unknown environment: $ENVIRONMENT"
exit 1
;;
esac

#prod
#aws s3 cp s3://reancare-configs/rean-admin-portal/.env ./.env
#aws s3 cp s3://reancare-configs/rean-admin-portal/constants.ts /app/src/lib

# #aha-prod
aws s3 cp s3://duploservices-ahaprod-configs-167414264568/rean-admin-portal/.env ./.env
#aws s3 cp s3://$S3_CONFIG_BUCKET/$S3_CONFIG_PATH/rean-admin-portal/constants.ts /app/src/lib
# Copy files from S3
aws s3 cp s3://$ENV_FILE_BUCKET/.env ./.env
aws s3 cp s3://$CONSTANTS_FILE_BUCKET/constants.ts /app/src/lib
aws s3 cp s3://$FAVICON_FILE_BUCKET/favicon.png ./static/favicon.png

cd /app/build
# Add any other scripts here...

# Start the service
# npm run start
node index.js
156 changes: 156 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1891102

Please sign in to comment.