diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..067b5a6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,28 @@ +# Git and version control +.git +.gitignore + +# Docker specific +Dockerfile + +# Node.js dependencies +node_modules/ +npm-debug.log* +yarn-error.log + +# Build output +dist/ +build/ + +# Environment variables +.env* + +# OS specific +.DS_Store +Thumbs.db + +# IDE specific +.vscode/ +.idea/ +*.swp +*.swo diff --git a/.eslintrc.js b/.eslintrc.js index 29d03f1..2593d89 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,7 @@ module.exports = { parser: '@typescript-eslint/parser', parserOptions: { - ecmaVersion: 2018, + ecmaVersion: 2022, sourceType: 'module', project: './tsconfig.json' }, @@ -15,6 +15,7 @@ module.exports = { }, extends: [ 'standard', + 'plugin:@typescript-eslint/recommended', ], rules: { 'no-unused-vars': 'off', diff --git a/Dockerfile b/Dockerfile index fa5d265..555a5e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:8 as build +FROM node:18-alpine as build WORKDIR /opt @@ -9,20 +9,22 @@ COPY internal internal COPY src src COPY type type -RUN npm run install:dev +COPY package-lock.json . +RUN npm install --legacy-peer-deps RUN npm run build -FROM node:8 +FROM node:18-alpine WORKDIR /opt COPY --from=build /opt/package.json package.json +COPY package-lock.json . COPY --from=build /opt/config config COPY --from=build /opt/dist dist -RUN npm run install:prod +RUN npm ci --only=production --legacy-peer-deps ENV PATH=/opt/node_modules/.bin:$PATH USER node -CMD ["npm"] +CMD ["node", "dist/index.js"] diff --git a/package.json b/package.json index 68ae449..d16b71f 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "description": "starting point of a new api", "private": true, "engines": { - "node": "^10.0.0", - "npm": "^6.4.0" + "node": "^18.17.0", + "npm": "^9.6.7" }, "types": "type/index.d.ts", "scripts": { @@ -35,26 +35,26 @@ "@types/cors": "2.8.4", "@types/express": "4.11.1", "@types/helmet": "0.0.37", - "@types/jest": "^23.3.9", + "@types/jest": "^29.5.5", "@types/lodash": "4.14.109", - "@types/node": "8.9.4", - "@typescript-eslint/eslint-plugin": "^1.4.2", - "@typescript-eslint/parser": "^1.4.2", - "eslint": "^5.15.2", + "@types/node": "^18.17.0", + "@typescript-eslint/eslint-plugin": "^6.7.3", + "@typescript-eslint/parser": "^6.7.3", + "eslint": "^8.50.0", "eslint-config-standard": "^12.0.0", "eslint-plugin-import": "^2.16.0", "eslint-plugin-node": "^8.0.1", "eslint-plugin-promise": "^4.0.1", "eslint-plugin-standard": "^4.0.0", - "jest": "^23.6.0", + "jest": "^29.7.0", "jest-config": "23.6.0", "nodemon": "1.17.4", - "ts-jest": "^23.10.4", + "ts-jest": "^29.1.1", "ts-node": "6.0.3", - "typescript": "3.3.3333" + "typescript": "^5.2.2" }, "optionalDependencies": { - "husky": "next" + "husky": "^8.0.0" }, "husky": { "hooks": { diff --git a/tsconfig.json b/tsconfig.json index 1a69840..8988e94 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es2018", + "target": "es2022", "module": "commonjs", "moduleResolution": "node", "outDir": "dist", @@ -9,7 +9,7 @@ "esModuleInterop": true, "strict": true, "lib": [ - "es2018" + "es2022" ] }, "include": [