diff --git a/Dockerfile b/Dockerfile index fbfad6cdb0..790ee4d6a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,12 +29,14 @@ RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSI && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz COPY . /usr/src/app -RUN yarn install --ignore-engines --frozen-lockfile --production --network-concurrency 1 \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf ~/.node-gyp \ - && rm -rf /tmp/yarn-* + +RUN yarn install --ignore-engines --frozen-lockfile --network-concurrency 1 + RUN yarn build +RUN rm -rf node_modules \ + && yarn install --production --frozen-lockfile --ignore-optional + ################################################################################ FROM node:${NODE_VERSION} @@ -46,7 +48,7 @@ RUN apt-get update && \ WORKDIR /usr/src/app # Keep the .git directory in order to properly report version -COPY . ./ +COPY ./package.json ./docker-entrypoint.sh ./ COPY --from=builder /usr/src/app/dist ./ COPY --from=builder /usr/src/app/node_modules ./node_modules/ COPY --from=builder /usr/local/bin/dockerize /usr/local/bin/ diff --git a/package.json b/package.json index 8c7b409b06..32fed638f5 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,6 @@ }, "homepage": "https://github.com/scality/backbeat#readme", "dependencies": { - "@types/node": "^18.11.9", "JSONStream": "^1.3.5", "arsenal": "git+https://github.com/scality/Arsenal#8.1.76", "async": "^2.3.0", @@ -64,7 +63,6 @@ "node-rdkafka": "^2.12.0", "node-schedule": "^1.2.0", "node-zookeeper-client": "^1.1.3", - "typescript": "^4.8.4", "uuid": "^3.1.0", "vaultclient": "scality/vaultclient#8.3.10", "werelogs": "scality/werelogs#8.1.2" @@ -82,7 +80,10 @@ "sinon": "^10.0.0", "ts-jest": "^29.0.3", "ts-node": "^10.9.1", - "zookeeper-mock": "^1.2.0" + "zookeeper-mock": "^1.2.0", + "typescript": "^4.8.4", + "@types/node": "^18.11.9", + "@tsconfig/node16": "^1.0.3" }, "jest": { "maxWorkers": 1, diff --git a/tsconfig.json b/tsconfig.json index 83b91b4f5e..9e0e378903 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,24 @@ { "compilerOptions": { - "target": "es6", - "module": "commonjs", - "rootDir": ".", - "resolveJsonModule": true, - "allowJs": true, - "checkJs": false, - "outDir": "dist", - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "declaration": true, - "noImplicitAny": false, - "noEmitOnError": false, - "sourceMap": true, - "skipLibCheck": true + /* Visit https://aka.ms/tsconfig to read more about this file */ + "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + "module": "commonjs", /* Specify what module code is generated. */ + "rootDir": "./", /* Specify the root folder within your source files. */ + "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + "outDir": "./dist", /* Specify an output folder for all emitted files. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "skipLibCheck": true, /* Skip type checking all .d.ts files. */ + "lib": ["es2021"], /* JS APIs and definitions to include */ + "target": "es2021", /* Specify JS target revision */ + "resolveJsonModule": true, /* Allows importing modules with a .json extension */ + "allowJs": true, /* Allow JavaScript files to be imported inside your project */ + "checkJs": false, /* Enable error reporting for JavaScript files */ + "noEmitOnError": false, /* Do not emit compiler output files like JavaScript source code, source-maps or declarations if any errors were reported. */ }, "include": [ "./bin", @@ -28,5 +32,6 @@ "exclude": [ "node_modules/*" ], - "compileOnSave": true + "compileOnSave": true, + "extends": "@tsconfig/node16/tsconfig.json" } diff --git a/yarn.lock b/yarn.lock index 8baa732638..0d5b6ae867 100644 --- a/yarn.lock +++ b/yarn.lock @@ -998,7 +998,7 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== -"@tsconfig/node16@^1.0.2": +"@tsconfig/node16@^1.0.2", "@tsconfig/node16@^1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==