From ba1adb18c6d4d29e5c1303098bedff889731dade Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Sat, 11 Nov 2023 15:19:15 +0530 Subject: [PATCH 01/17] first try --- .env.example | 6 +++--- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.env.example b/.env.example index 0378802..ba996ae 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,8 @@ # If ran on docker linux -DATABASE_URL="postgresql://username:password@:5432/autifynetwork" +DATABASE_URL="postgresql://username:password@:5432/ranter" # If ran on docker mac -DATABASE_URL="postgresql://username:password@host.docker.internal:5432/autifynetwork" +DATABASE_URL="postgresql://username:password@host.docker.internal:5432/ranter" # If ran locally -DATABASE_URL="postgresql://username:password@localhsot:5432/autifynetwork" +DATABASE_URL="postgresql://username:password@localhsot:5432/ranter" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b1f682a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI and Deploy to GKE + +on: + push: + branches: + - main + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up GKE + uses: imjasonh/gke-auth@v0.1.0 + with: + project: ${{ secrets.GCP_PROJECT_ID }} + location: ${{ secrets.GKE_CLUSTER_LOCATION }} + cluster: ${{ secrets.GKE_CLUSTER_NAME }} + + - name: Configure kubectl + run: | + mkdir -p $HOME/.kube + cp ./kubeconfig.yaml $HOME/.kube/config + kubectl config use-context ${{ secrets.GKE_CLUSTER_NAME }} + + - name: Build Docker image + run: docker build -t your-backend-image:latest . + + - name: Database Migrations + run: docker run --env-file=.env your-backend-image:latest npx prisma migrate dev --name init + + - name: Deploy to GKE + run: kubectl apply -f k8s/deployment.yaml From 101a9e2d179795cecb8fc6fbbe44d4a7e1343c16 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Sat, 11 Nov 2023 15:20:53 +0530 Subject: [PATCH 02/17] change --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1f682a..9a10384 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: CI and Deploy to GKE on: push: branches: - - main + - deployment-ci jobs: build-and-deploy: From e6c91d5061e1231ac8619b46796c56ee0c3a5524 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Sat, 11 Nov 2023 15:24:17 +0530 Subject: [PATCH 03/17] try --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a10384..2169857 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Set up GCP credentials + uses: google-github-actions/setup-gcloud@v0.2.1 + with: + service_account_key: ${{ secrets.GCP_SA_KEY }} + project_id: ${{ secrets.GCP_PROJECT_ID }} + - name: Set up GKE uses: imjasonh/gke-auth@v0.1.0 with: From 5ad8c2bab5e45d8af0bf3099bc5b473c0c1ae110 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Sat, 11 Nov 2023 15:28:05 +0530 Subject: [PATCH 04/17] test --- test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..a7c8577 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +test-engine $call \ No newline at end of file From 16226e133e544829a6ef25a525a2cf03f8bcd931 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Sat, 11 Nov 2023 15:35:25 +0530 Subject: [PATCH 05/17] test --- test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.txt b/test.txt index a7c8577..0387d69 100644 --- a/test.txt +++ b/test.txt @@ -1 +1 @@ -test-engine $call \ No newline at end of file +test-engine $call From 0d51ae3f13c18cfac63358b7b265b7e1e4c15a17 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Sat, 11 Nov 2023 16:05:40 +0530 Subject: [PATCH 06/17] try --- .github/workflows/ci.yml | 70 ++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2169857..0a94ae8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,42 +1,58 @@ -name: CI and Deploy to GKE +name: Build and Deploy to GKE on: push: branches: - - deployment-ci + - main + +env: + PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} + GKE_CLUSTER: ${{ secrets.GKE_CLUSTER_NAME }} + GKE_ZONE: ${{ secrets.GKE_CLUSTER_LOCATION }} + DEPLOYMENT_NAME: ranter-deploy-dev + IMAGE: ranter-dev-image jobs: - build-and-deploy: + setup-build-publish-deploy: + name: Setup, Build, Publish, and Deploy runs-on: ubuntu-latest + environment: production steps: - - name: Checkout repository + - name: Checkout uses: actions/checkout@v2 - - name: Set up GCP credentials - uses: google-github-actions/setup-gcloud@v0.2.1 + # Setup gcloud CLI + - uses: google-github-actions/setup-gcloud@v0.2.1 with: service_account_key: ${{ secrets.GCP_SA_KEY }} project_id: ${{ secrets.GCP_PROJECT_ID }} - - name: Set up GKE - uses: imjasonh/gke-auth@v0.1.0 - with: - project: ${{ secrets.GCP_PROJECT_ID }} - location: ${{ secrets.GKE_CLUSTER_LOCATION }} - cluster: ${{ secrets.GKE_CLUSTER_NAME }} - - - name: Configure kubectl - run: | - mkdir -p $HOME/.kube - cp ./kubeconfig.yaml $HOME/.kube/config - kubectl config use-context ${{ secrets.GKE_CLUSTER_NAME }} - - - name: Build Docker image - run: docker build -t your-backend-image:latest . - - - name: Database Migrations - run: docker run --env-file=.env your-backend-image:latest npx prisma migrate dev --name init - - - name: Deploy to GKE - run: kubectl apply -f k8s/deployment.yaml + # helper for authentication + - run: |- + gcloud --quiet auth configure-docker + + # Get the GKE credentials so we can deploy to the cluster + - run: |- + gcloud container clusters get-credentials $GKE_CLUSTER --zone $GKE_ZONE + + # Build the Docker image + - name: Build + run: |- + docker build \ + --tag "gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA" \ + --build-arg GITHUB_SHA="$GITHUB_SHA" \ + --build-arg GITHUB_REF="$GITHUB_REF" \ + . + + # Log in to Docker Hub + - name: Log in to Docker Hub + run: |- + echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin + + # Deploy the Docker image to the GKE cluster + - name: Deploy + run: |- + kubectl set image deployment/$DEPLOYMENT_NAME $DEPLOYMENT_NAME=gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA + kubectl rollout status deployment/$DEPLOYMENT_NAME + kubectl get services -o wide From ff51a642c5790fb0759c437f16ea3a66e752dbf2 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Sat, 11 Nov 2023 16:06:39 +0530 Subject: [PATCH 07/17] hsda --- .github/workflows/ci.yml | 2 +- test.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a94ae8..a0cf9dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: Build and Deploy to GKE on: push: branches: - - main + - deployment-ci env: PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} diff --git a/test.txt b/test.txt index 0387d69..330e8a1 100644 --- a/test.txt +++ b/test.txt @@ -1 +1,2 @@ test-engine $call +ds \ No newline at end of file From 471cc0e32260f66c2a609b594ea07a1f78f0ad47 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Sat, 11 Nov 2023 16:20:23 +0530 Subject: [PATCH 08/17] checknone --- .github/workflows/ci.yml | 20 ++++++++++++++------ test.txt | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0cf9dd..175835f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ env: PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} GKE_CLUSTER: ${{ secrets.GKE_CLUSTER_NAME }} GKE_ZONE: ${{ secrets.GKE_CLUSTER_LOCATION }} + DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} DEPLOYMENT_NAME: ranter-deploy-dev IMAGE: ranter-dev-image @@ -33,14 +34,15 @@ jobs: gcloud --quiet auth configure-docker # Get the GKE credentials so we can deploy to the cluster - - run: |- - gcloud container clusters get-credentials $GKE_CLUSTER --zone $GKE_ZONE + - name: Get GKE credentials + run: |- + gcloud container clusters get-credentials $GKE_CLUSTER --zone $GKE_ZONE --project $PROJECT_ID # Build the Docker image - name: Build run: |- docker build \ - --tag "gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA" \ + --tag "$DOCKER_HUB_USERNAME/$IMAGE:$GITHUB_SHA" \ --build-arg GITHUB_SHA="$GITHUB_SHA" \ --build-arg GITHUB_REF="$GITHUB_REF" \ . @@ -50,9 +52,15 @@ jobs: run: |- echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin + # Get the access token + - name: Get access token + id: get-access-token + run: |- + echo "::set-output name=access_token::$(gcloud auth print-access-token)" + # Deploy the Docker image to the GKE cluster - name: Deploy run: |- - kubectl set image deployment/$DEPLOYMENT_NAME $DEPLOYMENT_NAME=gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA - kubectl rollout status deployment/$DEPLOYMENT_NAME - kubectl get services -o wide + kubectl set image deployment/$DEPLOYMENT_NAME $DEPLOYMENT_NAME=$DOCKER_HUB_USERNAME/$IMAGE:$GITHUB_SHA --token "${{ steps.get-access-token.outputs.access_token }}" + kubectl rollout status deployment/$DEPLOYMENT_NAME --token "${{ steps.get-access-token.outputs.access_token }}" + kubectl get services -o wide --token "${{ steps.get-access-token.outputs.access_token }}" diff --git a/test.txt b/test.txt index 330e8a1..8133b63 100644 --- a/test.txt +++ b/test.txt @@ -1,2 +1,2 @@ test-engine $call -ds \ No newline at end of file +ds From 4eeba912c45ae7009f7b60c25c00ade89b410a9f Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Sat, 11 Nov 2023 16:46:54 +0530 Subject: [PATCH 09/17] chnage tav' --- .github/workflows/ci.yml | 5 +++++ ci/deployment.yml | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 ci/deployment.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 175835f..0dfbf44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,11 @@ jobs: run: |- echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin + # Push the Docker image to Docker Hub + - name: Push + run: |- + docker push "$DOCKER_HUB_USERNAME/$IMAGE:$GITHUB_SHA" + # Get the access token - name: Get access token id: get-access-token diff --git a/ci/deployment.yml b/ci/deployment.yml new file mode 100644 index 0000000..6625a04 --- /dev/null +++ b/ci/deployment.yml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ranter-deploy-dev +spec: + replicas: 3 + selector: + matchLabels: + app: ranter + template: + metadata: + labels: + app: ranter + spec: + containers: + - name: ranter + image: gcr.io/PROJECT_ID/IMAGE:TAG + ports: + - containerPort: 8080 From 49d6f1ac01fbc8e366e6ce25bb3d66d0b789fecc Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Sat, 11 Nov 2023 16:53:52 +0530 Subject: [PATCH 10/17] change --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0dfbf44..5efd0d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: run: |- echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin - # Push the Docker image to Docker Hub + # Push the Docker image - name: Push run: |- docker push "$DOCKER_HUB_USERNAME/$IMAGE:$GITHUB_SHA" From 195de11693c6abe8f587ab0c44b4e0b2cfe521a7 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Sat, 11 Nov 2023 17:01:01 +0530 Subject: [PATCH 11/17] chec test --- ci/deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/deployment.yml b/ci/deployment.yml index 6625a04..029115a 100644 --- a/ci/deployment.yml +++ b/ci/deployment.yml @@ -14,6 +14,6 @@ spec: spec: containers: - name: ranter - image: gcr.io/PROJECT_ID/IMAGE:TAG + image: spantheslayer/ranter-dev-image ports: - containerPort: 8080 From 1e178a05e90cb45de5b2ace0bc9db0c846cf2002 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Sat, 11 Nov 2023 17:17:10 +0530 Subject: [PATCH 12/17] change --- .github/workflows/ci.yml | 6 +++--- ci/deployment.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5efd0d3..e62d445 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: - name: Build run: |- docker build \ - --tag "$DOCKER_HUB_USERNAME/$IMAGE:$GITHUB_SHA" \ + --tag "$DOCKER_HUB_USERNAME/$IMAGE:latest" \ --build-arg GITHUB_SHA="$GITHUB_SHA" \ --build-arg GITHUB_REF="$GITHUB_REF" \ . @@ -55,7 +55,7 @@ jobs: # Push the Docker image - name: Push run: |- - docker push "$DOCKER_HUB_USERNAME/$IMAGE:$GITHUB_SHA" + docker push "$DOCKER_HUB_USERNAME/$IMAGE:latest" # Get the access token - name: Get access token @@ -66,6 +66,6 @@ jobs: # Deploy the Docker image to the GKE cluster - name: Deploy run: |- - kubectl set image deployment/$DEPLOYMENT_NAME $DEPLOYMENT_NAME=$DOCKER_HUB_USERNAME/$IMAGE:$GITHUB_SHA --token "${{ steps.get-access-token.outputs.access_token }}" + kubectl set image deployment/$DEPLOYMENT_NAME $DEPLOYMENT_NAME=$DOCKER_HUB_USERNAME/$IMAGE:latest --token "${{ steps.get-access-token.outputs.access_token }}" kubectl rollout status deployment/$DEPLOYMENT_NAME --token "${{ steps.get-access-token.outputs.access_token }}" kubectl get services -o wide --token "${{ steps.get-access-token.outputs.access_token }}" diff --git a/ci/deployment.yml b/ci/deployment.yml index 029115a..bf9c065 100644 --- a/ci/deployment.yml +++ b/ci/deployment.yml @@ -14,6 +14,6 @@ spec: spec: containers: - name: ranter - image: spantheslayer/ranter-dev-image + image: spantheslayer/ranter-dev-image:latest ports: - containerPort: 8080 From 45051b4e05eed4ca355a831aef023f5523a5fe07 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Mon, 13 Nov 2023 14:48:05 +0530 Subject: [PATCH 13/17] chore: new try --- .docker/scripts.sh | 7 +++ .github/workflows/build-image.yml | 33 ++++++++++++++ .github/workflows/ci.yml | 71 ------------------------------- .github/workflows/spinup.yml | 33 ++++++++++++++ Dockerfile | 21 +++++++-- eslintonld.json | 69 ------------------------------ 6 files changed, 90 insertions(+), 144 deletions(-) create mode 100644 .docker/scripts.sh create mode 100644 .github/workflows/build-image.yml delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/spinup.yml delete mode 100644 eslintonld.json diff --git a/.docker/scripts.sh b/.docker/scripts.sh new file mode 100644 index 0000000..f7aaa8f --- /dev/null +++ b/.docker/scripts.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "Applying Database Migrations" +/app/node_modules/.bin/prisma migrate deploy + +echo "Starting Application" +node /app/lib/servers/graphql-main.js \ No newline at end of file diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml new file mode 100644 index 0000000..cfa1cdf --- /dev/null +++ b/.github/workflows/build-image.yml @@ -0,0 +1,33 @@ +name: Build and Push Docker image + +on: + push: + branches: + - 'deployment-ci' + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ secrets.DOCKER_HUB_USERNAME }}/my-app:latest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index e62d445..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Build and Deploy to GKE - -on: - push: - branches: - - deployment-ci - -env: - PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} - GKE_CLUSTER: ${{ secrets.GKE_CLUSTER_NAME }} - GKE_ZONE: ${{ secrets.GKE_CLUSTER_LOCATION }} - DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} - DEPLOYMENT_NAME: ranter-deploy-dev - IMAGE: ranter-dev-image - -jobs: - setup-build-publish-deploy: - name: Setup, Build, Publish, and Deploy - runs-on: ubuntu-latest - environment: production - - steps: - - name: Checkout - uses: actions/checkout@v2 - - # Setup gcloud CLI - - uses: google-github-actions/setup-gcloud@v0.2.1 - with: - service_account_key: ${{ secrets.GCP_SA_KEY }} - project_id: ${{ secrets.GCP_PROJECT_ID }} - - # helper for authentication - - run: |- - gcloud --quiet auth configure-docker - - # Get the GKE credentials so we can deploy to the cluster - - name: Get GKE credentials - run: |- - gcloud container clusters get-credentials $GKE_CLUSTER --zone $GKE_ZONE --project $PROJECT_ID - - # Build the Docker image - - name: Build - run: |- - docker build \ - --tag "$DOCKER_HUB_USERNAME/$IMAGE:latest" \ - --build-arg GITHUB_SHA="$GITHUB_SHA" \ - --build-arg GITHUB_REF="$GITHUB_REF" \ - . - - # Log in to Docker Hub - - name: Log in to Docker Hub - run: |- - echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin - - # Push the Docker image - - name: Push - run: |- - docker push "$DOCKER_HUB_USERNAME/$IMAGE:latest" - - # Get the access token - - name: Get access token - id: get-access-token - run: |- - echo "::set-output name=access_token::$(gcloud auth print-access-token)" - - # Deploy the Docker image to the GKE cluster - - name: Deploy - run: |- - kubectl set image deployment/$DEPLOYMENT_NAME $DEPLOYMENT_NAME=$DOCKER_HUB_USERNAME/$IMAGE:latest --token "${{ steps.get-access-token.outputs.access_token }}" - kubectl rollout status deployment/$DEPLOYMENT_NAME --token "${{ steps.get-access-token.outputs.access_token }}" - kubectl get services -o wide --token "${{ steps.get-access-token.outputs.access_token }}" diff --git a/.github/workflows/spinup.yml b/.github/workflows/spinup.yml new file mode 100644 index 0000000..d505571 --- /dev/null +++ b/.github/workflows/spinup.yml @@ -0,0 +1,33 @@ +name: Spinup Server + +on: + push: + branches: ['deployment-ci'] + +jobs: + spinup-server: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '16' + + - name: Install direnv + run: sudo apt-get install direnv -y + + - name: Install dependencies + run: yarn install + + - name: Build the app + run: yarn build + + - name: Run Server & Get Healthz + run: | + . ./.envrc && yarn start & + sleep 5 + curl --fail http://localhost:4000/healthz diff --git a/Dockerfile b/Dockerfile index 42e6e3e..5beafa8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,23 @@ -FROM node:18 +FROM node:18 AS BUILD_IMAGE WORKDIR /app # Install dependencies -COPY *.json ./yarn.lock ./ +COPY . . RUN yarn install --frozen-lockfile -# Run Source Code -COPY . . \ No newline at end of file +# Build Source Code +COPY ./src ./src +RUN yarn build +RUN yarn install --frozen-lockfile --production + +FROM node:16 +COPY --from=BUILD_IMAGE /app/lib /app/lib +COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules +COPY --from=BUILD_IMAGE /app/prisma /app/prisma +COPY --from=BUILD_IMAGE /app/.docker/scripts /app/.docker/scripts + +WORKDIR /app +COPY ./*.js ./package.json ./tsconfig.json ./yarn.lock ./default.yaml ./ + +CMD [".docker/scripts/start.sh"] \ No newline at end of file diff --git a/eslintonld.json b/eslintonld.json deleted file mode 100644 index 880110b..0000000 --- a/eslintonld.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "env": { - "node": true - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.json", - "sourceType": "module" - }, - "plugins": ["eslint-plugin-import", "@typescript-eslint", "prettier"], - "extends": [ - "eslint:recommended", - "plugin:import/recommended", - "plugin:import/typescript", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "rules": { - "@typescript-eslint/no-extra-semi": "off", - - "@typescript-eslint/prefer-for-of": "error", - "@typescript-eslint/unified-signatures": "error", - - "import/no-deprecated": "error", - "import/no-extraneous-dependencies": "error", - "import/no-unassigned-import": "error", - "import/no-unresolved": "off", - "import/order": [ - "error", - { "newlines-between": "always-and-inside-groups" } - ], - - "prettier/prettier": [ - "error", - { - "semi": false, - "trailingComma": "none", - "quoteProps": "consistent", - "singleQuote": true, - "tabWidth": 4, - "useTabs": false, - "bracketSpacing": true, - "arrowParens": "always", - "proseWrap": "preserve", - "endOfLine": "lf" - } - ], - - "arrow-body-style": "off", - "prefer-arrow-callback": "off", - - "no-empty": ["error", { "allowEmptyCatch": true }], - "no-new-wrappers": "error", - "no-param-reassign": "error", - "no-return-await": "error", - "no-sequences": "error", - "no-throw-literal": "error", - "no-void": "error", - "@typescript-eslint/explicit-module-boundary-types": "off", - "no-async-promise-executor": "off" - }, - "settings": { - "import/resolver": { - "node": { - "paths": ["."] - } - } - } -} From f21aa8b1a481a76dd172d7a627cdbfd37dd6b4fb Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Mon, 13 Nov 2023 14:50:14 +0530 Subject: [PATCH 14/17] chore: update --- .docker/{scripts.sh => scripts/start.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .docker/{scripts.sh => scripts/start.sh} (100%) diff --git a/.docker/scripts.sh b/.docker/scripts/start.sh similarity index 100% rename from .docker/scripts.sh rename to .docker/scripts/start.sh From 87ecd6cb042f2d7ab37fd2c575b92a780da05e77 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Mon, 13 Nov 2023 14:52:00 +0530 Subject: [PATCH 15/17] chore:update --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5beafa8..bbcaca2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ COPY ./src ./src RUN yarn build RUN yarn install --frozen-lockfile --production -FROM node:16 +FROM node:18 COPY --from=BUILD_IMAGE /app/lib /app/lib COPY --from=BUILD_IMAGE /app/node_modules /app/node_modules COPY --from=BUILD_IMAGE /app/prisma /app/prisma From e0b51fa43cbd7e56c0124d04907c527c9a9773b7 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Mon, 13 Nov 2023 14:58:46 +0530 Subject: [PATCH 16/17] chore: update --- test.txt | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 test.txt diff --git a/test.txt b/test.txt deleted file mode 100644 index 8133b63..0000000 --- a/test.txt +++ /dev/null @@ -1,2 +0,0 @@ -test-engine $call -ds From d825fcd4b0d2fc7fee2e68503be78ed81607ed15 Mon Sep 17 00:00:00 2001 From: spantheslayer Date: Mon, 13 Nov 2023 14:59:54 +0530 Subject: [PATCH 17/17] chore: update --- .github/workflows/spinup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spinup.yml b/.github/workflows/spinup.yml index d505571..7468341 100644 --- a/.github/workflows/spinup.yml +++ b/.github/workflows/spinup.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '16' + node-version: '18' - name: Install direnv run: sudo apt-get install direnv -y