Browse Source

Updates with Dockerfile and tweaks for db persistence

unsubscribe-mute
Matthew Raymer 1 year ago
parent
commit
bcb636c150
  1. 1
      .gitignore
  2. 5
      Dockerfile
  3. 3
      build.sh
  4. 112
      package.json
  5. 2
      src/db.ts

1
.gitignore

@ -2,3 +2,4 @@
node_modules
build
web_push
data

5
Dockerfile

@ -1,6 +1,6 @@
FROM node:18.17.1-alpine3.17
RUN mkdir -p /usr/src/app
RUN mkdir -p /usr/src/app/data
WORKDIR /usr/src/app
COPY package*.json ./
@ -9,8 +9,9 @@ COPY .eslintrc.json ./
COPY src ./src
RUN npm install
RUN npm run build
EXPOSE 3000
CMD [ "npm", "start" ]
CMD [ "npm", "start" ]

3
build.sh

@ -0,0 +1,3 @@
#!/bin/bash
docker build . -t endorser-push-server:1.0 --no-cache

112
package.json

@ -1,58 +1,58 @@
{
"name": "node-typescript-boilerplate",
"version": "0.0.0",
"description": "Minimalistic boilerplate to quick-start Node.js development in TypeScript.",
"type": "module",
"engines": {
"node": ">= 18.12 <19"
},
"devDependencies": {
"@types/body-parser": "^1.19.2",
"@types/express": "^4.17.17",
"@types/jest": "~29.5",
"@types/jsonwebtoken": "^9.0.2",
"@types/node": "~20",
"@types/sqlite3": "^3.1.8",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"eslint": "~8.47",
"eslint-config-prettier": "~9.0",
"eslint-plugin-jest": "~27.2",
"jest": "~29.6",
"prettier": "~3.0",
"rimraf": "~5.0",
"ts-api-utils": "~1.0",
"ts-jest": "~29.1",
"typescript": "~5.1"
},
"scripts": {
"start": "node build/src/main.js",
"clean": "rimraf coverage build tmp",
"prebuild": "npm run lint",
"build": "tsc -p tsconfig.json",
"build:watch": "tsc -w -p tsconfig.json",
"build:release": "npm run clean && tsc -p tsconfig.release.json",
"lint": "eslint . --ext .ts --ext .mts",
"test": "jest --coverage",
"prettier": "prettier --config .prettierrc --write .",
"test:watch": "jest --watch"
},
"author": "Jakub Synowiec <jsynowiec@users.noreply.github.com>",
"license": "Apache-2.0",
"dependencies": {
"body-parser": "^1.20.2",
"elliptic": "^6.5.4",
"express": "^4.18.2",
"http_ece": "^1.1.0",
"jsonwebtoken": "^9.0.1",
"node-fetch": "^3.3.2",
"npm-check-updates": "16.11.1",
"reflect-metadata": "^0.1.13",
"sqlite3": "^5.1.6",
"tslib": "~2.6",
"typeorm": "^0.3.17"
},
"volta": {
"node": "18.12.1"
}
"name": "node-typescript-boilerplate",
"version": "0.0.0",
"description": "Minimalistic boilerplate to quick-start Node.js development in TypeScript.",
"type": "module",
"engines": {
"node": ">= 18.12 <19"
},
"devDependencies": {
"@types/body-parser": "^1.19.2",
"@types/express": "^4.17.17",
"@types/jest": "~29.5",
"@types/jsonwebtoken": "^9.0.2",
"@types/node": "~20",
"@types/sqlite3": "^3.1.8",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"eslint": "~8.47",
"eslint-config-prettier": "~9.0",
"eslint-plugin-jest": "~27.2",
"jest": "~29.6",
"prettier": "~3.0",
"rimraf": "~5.0",
"ts-api-utils": "~1.0",
"ts-jest": "~29.1",
"typescript": "~5.1"
},
"scripts": {
"start": "node build/src/main.js",
"clean": "rimraf coverage build tmp",
"prebuild": "npm run lint",
"build": "tsc -p tsconfig.json",
"build:watch": "tsc -w -p tsconfig.json",
"build:release": "npm run clean && tsc -p tsconfig.release.json",
"lint": "eslint . --ext .ts --ext .mts",
"test": "jest --coverage",
"prettier": "prettier --config .prettierrc --write .",
"test:watch": "jest --watch"
},
"author": "Jakub Synowiec <jsynowiec@users.noreply.github.com>",
"license": "Apache-2.0",
"dependencies": {
"body-parser": "^1.20.2",
"elliptic": "^6.5.4",
"express": "^4.18.2",
"http_ece": "^1.1.0",
"jsonwebtoken": "^9.0.1",
"node-fetch": "^3.3.2",
"npm-check-updates": "16.11.1",
"reflect-metadata": "^0.1.13",
"sqlite3": "^5.1.6",
"tslib": "~2.6",
"typeorm": "^0.3.17"
},
"volta": {
"node": "18.12.1"
}
}

2
src/db.ts

@ -15,7 +15,7 @@ class DBService {
private constructor() {
this.dataSource = new DataSource({
type: "sqlite",
database: "push_server",
database: "data/push_server",
entities: [VapidKeys, Subscription],
synchronize: true
});

Loading…
Cancel
Save