Skip to content

Commit

Permalink
Merge branch 'develop' into feat/show-all-variables-on-screen
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdip-b authored Jan 4, 2025
2 parents b4f07a6 + 18cf765 commit 82205f5
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 98 deletions.
78 changes: 27 additions & 51 deletions .github/workflows/deploy-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'beta' || 'stage' }}
environment: ${{ github.ref == 'refs/heads/main' && 'alpha' || 'stage' }}
name: Build and push API docker image for release

steps:
Expand All @@ -32,59 +32,35 @@ jobs:
REPOSITORY_NAME: api
run: |
# Build a docker container and push it to ACR
docker build -t $ACR_REGISTRY_URL/$REPOSITORY_NAME:${GITHUB_SHA::6} -t $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest -f ./apps/web/Dockerfile .
docker build -t $ACR_REGISTRY_URL/$REPOSITORY_NAME:${GITHUB_SHA::6} -t $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest -f ./apps/api/Dockerfile .
echo "Pushing image to ACR..."
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:${GITHUB_SHA::6}
echo "name=image::$ACR_REGISTRY_URL/$REPOSITORY_NAME:latest" >> $GITHUB_OUTPUT
# setup-database:
# needs: build
# name: Setup Database
# runs-on: ubuntu-latest
# environment: alpha

# steps:
# - name: Checkout
# uses: actions/checkout@v4

# - name: Install Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 20

# - name: Install pnpm
# uses: pnpm/action-setup@v4
# with:
# version: 9.2.0
# run_install: false

# - name: Deploy migrations
# env:
# DATABASE_URL: ${{ secrets.DATABASE_URL }}
# run: pnpm db:deploy-migrations

# deploy:
# needs: [build, setup-database]
# runs-on: ubuntu-latest
# environment: alpha
# name: Deploy API docker image for release

# steps:
# - name: Checkout
# uses: actions/checkout@v4

# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.SECRET_KEY }}
# aws-region: ap-south-1
deploy:
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'alpha' || 'stage' }}
name: Restart API container app
needs: build
steps:
- name: Azure Login action
uses: azure/login@v2
with:
creds: ${{ secrets.CONTAINER_APP_SP_CREDENTIALS }}
enable-AzPSSession: true

# - name: Force re-deploy task in service
# id: force-redeploy
# env:
# ECS_CLUSTER: ${{ vars.ECS_CLUSTER }}
# ECS_SERVICE: ${{ vars.ECS_API_SERVICE }}
# run: |
# aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment
- name: Azure CLI script
uses: azure/cli@v2
env:
API_CONTAINER: ${{ vars.API_CONTAINER }}
API_CONTAINER_RG: ${{ vars.API_CONTAINER_RG }}
ACR_REGISTRY_URL: ${{ vars.ACR_REGISTRY_URL }}
REPOSITORY_NAME: api
with:
azcliversion: latest
inlineScript: |
az containerapp update \
--name $API_CONTAINER \
--resource-group $API_CONTAINER_RG \
--image $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest
35 changes: 16 additions & 19 deletions .github/workflows/deploy-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'beta' || 'stage' }}
environment: ${{ github.ref == 'refs/heads/main' && 'alpha' || 'stage' }}
name: Build and push Platform docker image for release

steps:
Expand Down Expand Up @@ -44,26 +44,23 @@ jobs:
echo "name=image::$ACR_REGISTRY_URL/$REPOSITORY_NAME:latest" >> $GITHUB_OUTPUT
# deploy:
# needs: build
# runs-on: ubuntu-latest
# environment: alpha
# name: Deploy Platform docker image for release

# environment: ${{ github.ref == 'refs/heads/main' && 'alpha' || 'stage' }}
# name: Restart Platform container app
# needs: build
# steps:
# - name: Checkout
# uses: actions/checkout@v4

# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# - name: Azure Login action
# uses: azure/login@v2
# with:
# aws-access-key-id: ${{ secrets.ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.SECRET_KEY }}
# aws-region: ap-south-1
# creds: ${{ secrets.CONTAINER_APP_SP_CREDENTIALS }}
# enable-AzPSSession: true

# - name: Force re-deploy task in service
# id: force-redeploy
# - name: Azure CLI script
# uses: azure/cli@v2
# env:
# ECS_CLUSTER: ${{ vars.ECS_CLUSTER }}
# ECS_SERVICE: ${{ vars.ECS_PLATFORM_SERVICE }}
# run: |
# aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment
# PLATFORM_CONTAINER: ${{ vars.PLATFORM_CONTAINER }}
# PLATFORM_CONTAINER_RG: ${{ vars.PLATFORM_CONTAINER_RG }}
# with:
# azcliversion: latest
# inlineScript: |
# az container restart --name $PLATFORM_CONTAINER --resource-group $PLATFORM_CONTAINER_RG
50 changes: 26 additions & 24 deletions .github/workflows/deploy-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'beta' || 'stage' }}
environment: ${{ github.ref == 'refs/heads/main' && 'alpha' || 'stage' }}
name: Build and push Web docker image for release

steps:
Expand All @@ -38,27 +38,29 @@ jobs:
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:${GITHUB_SHA::6}
echo "name=image::$ACR_REGISTRY_URL/$REPOSITORY_NAME:latest" >> $GITHUB_OUTPUT
# deploy:
# needs: build
# runs-on: ubuntu-latest
# environment: alpha
# name: Deploy Web docker image for release

# steps:
# - name: Checkout
# uses: actions/checkout@v4

# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.SECRET_KEY }}
# aws-region: ap-south-1
deploy:
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'alpha' || 'stage' }}
name: Restart Web container app
needs: build
steps:
- name: Azure Login action
uses: azure/login@v2
with:
creds: ${{ secrets.CONTAINER_APP_SP_CREDENTIALS }}
enable-AzPSSession: true

# - name: Force re-deploy task in service
# id: force-redeploy
# env:
# ECS_CLUSTER: ${{ vars.ECS_CLUSTER }}
# ECS_SERVICE: ${{ vars.ECS_WEB_SERVICE }}
# run: |
# aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment
- name: Azure CLI script
uses: azure/cli@v2
env:
WEB_CONTAINER: ${{ vars.WEB_CONTAINER }}
WEB_CONTAINER_RG: ${{ vars.WEB_CONTAINER_RG }}
ACR_REGISTRY_URL: ${{ vars.ACR_REGISTRY_URL }}
REPOSITORY_NAME: web
with:
azcliversion: latest
inlineScript: |
az containerapp update \
--name $WEB_CONTAINER \
--resource-group $WEB_CONTAINER_RG \
--image $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest
4 changes: 3 additions & 1 deletion apps/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ USER node

FROM node:20-alpine AS prod

RUN apk add --no-cache openssl

# Don't run production as root
USER node

Expand All @@ -42,6 +44,6 @@ COPY --chown=root:root --chmod=755 --from=build /app/node_modules /app/node_modu
COPY --chown=root:root --chmod=755 --from=build /app/apps/api/node_modules /app/apps/api/node_modules
COPY --chown=root:root --chmod=755 --from=build /app/apps/api/dist /app/apps/api/dist

EXPOSE ${API_PORT}
EXPOSE 4200

ENTRYPOINT ["node", "/app/apps/api/dist/main.js"]
1 change: 1 addition & 0 deletions apps/api/src/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl"]
}

datasource db {
Expand Down
4 changes: 2 additions & 2 deletions apps/platform/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ COPY --from=installer --chown=nextjs:nodejs /app/apps/platform/.next ./apps/pla
COPY --from=installer --chown=nextjs:nodejs /app/apps/platform/public ./apps/platform/public


ENV PORT=3025
ENV PORT=3000
ENV NEXT_SHARP_PATH=/app/apps/platform/.next/sharp
EXPOSE 3025
EXPOSE 3000
# keyshade-ignore
ENV HOSTNAME "0.0.0.0"

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"docker:build:web": "docker build -t ks-web -f apps/web/Dockerfile .",
"docker:run:api": "docker run --env-file .env --name ks-api --rm -p 4200:4200 ks-api",
"docker:build:api": "docker build -t ks-api -f apps/api/Dockerfile .",
"docker:run:platform": "docker run --env-file .env --name ks-platform --rm -p 3025:3025 ks-platform",
"docker:run:platform": "docker run --env-file .env --name ks-platform --rm -p 3000:3000 ks-platform",
"docker:build:platform": "docker build -t ks-platform -f apps/platform/Dockerfile ."
},
"devDependencies": {
Expand Down

0 comments on commit 82205f5

Please sign in to comment.