Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
vinitparekh17 committed Jun 21, 2024
0 parents commit 2d62a27
Show file tree
Hide file tree
Showing 80 changed files with 11,963 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version = 1

[[analyzers]]
name = "javascript"

[analyzers.meta]
environment = [
"nodejs",
"mongo"
]
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
logs
dist
.env
.github
.husky
dist
github-assets
20 changes: 20 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
PORT=8080
MONGO_URI=


AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=

REGION=

JWT_SECRET=
JWT_EXPIRY=

STRIPE_ACCOUNT_ID=
STRIPE_SECRET=

RAZORPAY_ID=
RAZORPAY_SECRET=

GOOGLE_API_KEY=
GOOGLE_PROJECT_ID=
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
env: {
es2021: true,
node: true,
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 13,
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
rules: {},
};
59 changes: 59 additions & 0 deletions .github/workflows/docker-image-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build and push Docker image
on:
push:
branches:
- 'main'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: vparekh17/aiserver
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
# Deploy:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout the repo
# uses: actions/checkout@v2

# - name: Deploy to EC2
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USERNAME }}
# key: ${{ secrets.PRIVATE_KEY }}
# script: |
# cd ~
# pm2 stop all
# rm -rf openai-chatbot
# git clone https://github.com/vinitparekh17/openai-server.git openai-chatbot
# cd openai-chatbot
# yarn install
# yarn build
# pm2 start dist/index.js
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
.env
logs
.git
src/lib/index.html
dist
.drizzle
cert
terraform
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarn format
yarn test
10 changes: 10 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 4,
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf"
}
45 changes: 45 additions & 0 deletions .yarnclean
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# test directories
__tests__
test
tests
powered-test

# asset directories
docs
doc
website
images
assets

# examples
example
examples

# code coverage directories
coverage
.nyc_output

# build scripts
Makefile
Gulpfile.js
Gruntfile.js

# configs
appveyor.yml
circle.yml
codeship-services.yml
codeship-steps.yml
wercker.yml
.tern-project
.gitattributes
.editorconfig
.*ignore
.eslintrc
.jshintrc
.flowconfig
.documentup.json
.yarn-metadata.json
.travis.yml

# misc
*.md
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Stage 1: Build
FROM node:20-alpine as builder

# Set the working directory
WORKDIR /usr/src/app

# Copy package.json and yarn.lock to install dependencies
COPY package.json yarn.lock ./

# Install dependencies
RUN yarn install --frozen-lockfile

# Copy the rest of the application files
COPY . .

# Build the application
RUN yarn build

# Stage 2: Production
FROM node:20.13-bullseye-slim

ENV NODE_ENV=production

# Use a non-root user for security
USER node

# Set the working directory
WORKDIR /usr/src/app

# Copy only the necessary files from the builder stage
COPY --chown=node:node package.json yarn.lock ./

# Install only production dependencies
RUN yarn install --production --frozen-lockfile

# Copy the built application from the builder stage
COPY --from=builder --chown=node:node /usr/src/app/dist ./dist

EXPOSE 8080

CMD ["node", "dist/src/index.js"]
Loading

0 comments on commit 2d62a27

Please sign in to comment.