🐳 Docker configuration

This commit is contained in:
2021-08-31 09:32:39 -07:00
parent 8dc5daf3e0
commit 9c13c41e02
5 changed files with 1225 additions and 527 deletions

View File

@@ -1,8 +1,7 @@
FROM node:lts-alpine
FROM node:12-alpine
# Working directory
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json ./
RUN npm ci --silent
@@ -15,5 +14,6 @@ ENV NODE_ENV=production
RUN npm run build \
&& npm prune
EXPOSE 3080
# Start server
CMD ["npm", "start"]
CMD ["npm", "start"]

View File

@@ -47,7 +47,7 @@ const brokerConfig: BrokerOptions = {
// Using colors on the output
colors: true,
// Print module names with different colors (like docker-compose for containers)
moduleColors: false,
moduleColors: true,
// Line formatter. It can be "json", "short", "simple", "full", a `Function` or a template string like "{timestamp} {level} {nodeID}/{mod}: {msg}"
formatter: "full",
// Custom object printer. If not defined, it uses the `util.inspect` method.

1736
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@
"scripts": {
"build": "tsc --build tsconfig.json",
"dev": "ts-node ./node_modules/moleculer/bin/moleculer-runner.js --hot --repl --config moleculer.config.ts services/**/*.service.ts",
"start": "moleculer-runner --config dist/moleculer.config.js",
"start": "moleculer-runner --config dist/moleculer.config.js dist/**/*.service.js",
"cli": "moleculer connect NATS",
"ci": "jest --watch",
"test": "jest --coverage",
@@ -24,7 +24,6 @@
"@types/string-similarity": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"axios": "^0.21.1",
"eslint": "^6.8.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-prefer-arrow": "^1.2.2",
@@ -36,9 +35,11 @@
"ts-node": "^8.8.1"
},
"dependencies": {
"@types/axios": "^0.14.0",
"@types/jest": "^25.1.4",
"@types/mkdirp": "^1.0.0",
"@types/node": "^13.9.8",
"axios": "^0.21.1",
"imghash": "^0.0.9",
"leven": "^3.1.0",
"lodash": "^4.17.21",

View File

@@ -2,12 +2,11 @@
import { Service, ServiceBroker, Context } from "moleculer";
import axios from "axios";
import leven from "leven";
import { matchScorer } from "../utils/searchmatchscorer.utils";
const CV_BASE_URL = "https://comicvine.gamespot.com/api/";
const CV_API_KEY = "a5fa0663683df8145a85d694b5da4b87e1c92c69";
export default class GreeterService extends Service {
export default class ComicVineService extends Service {
public constructor(public broker: ServiceBroker) {
super(broker);
this.parseServiceSchema({