Skip to content

Commit

Permalink
TypeScript + Sapphire Framework update.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBazlow committed Apr 15, 2023
1 parent 4a34595 commit fcd3124
Show file tree
Hide file tree
Showing 30 changed files with 1,113 additions and 3,297 deletions.
4 changes: 1 addition & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
node_modules
npm-debug.log
.eslintrc.json
pnpm-lock.yaml
.env
.config.json
.gitignore
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*
!/src
19 changes: 19 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"env": {
"node": true,
"es2022": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/strict"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"root": true,
"parserOptions": {
"ecmaVersion": "latest",
"project": true
}
}
49 changes: 0 additions & 49 deletions .eslintrc.json

This file was deleted.

6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
pnpm-lock.yaml
dist
.env
config.json
.history
.history
.vscode
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*
!/src
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
63 changes: 50 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,50 @@
FROM node:18-alpine
# Create app directory
WORKDIR /usr/src/bot
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
# RUN npm install
# If you are building your code for production
RUN npm ci --only=production
# Bundle app source
COPY . .
CMD [ "node", "./src/index.js" ]
# ================ #
# Base Stage #
# ================ #

FROM node:19-alpine as base

RUN corepack enable pnpm
RUN corepack prepare pnpm@latest --activate

# ======================== #
# Dependencies Stage #
# ======================== #

FROM base as dependencies

WORKDIR /opt/app
COPY package.json .
COPY tsconfig.json .
COPY src ./src
RUN pnpm install

# ================= #
# Build Stage #
# ================= #

FROM base as build

WORKDIR /opt/app
COPY --from=dependencies /opt/app .
RUN pnpm build
RUN pnpm prune --prod

# ================== #
# Deploy Stage #
# ================== #

FROM base as deploy

ENV NODE_ENV="production"

WORKDIR /opt/app
COPY --from=build /opt/app/dist ./dist
COPY --from=build /opt/app/node_modules ./node_modules
COPY --from=build /opt/app/package.json ./package.json

RUN chown node:node .

USER node

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

0 comments on commit fcd3124

Please sign in to comment.