diff --git a/frameworks/JavaScript/fastify/app.js b/frameworks/JavaScript/fastify/app.js index 3c93710e83d..12b3aa0440c 100755 --- a/frameworks/JavaScript/fastify/app.js +++ b/frameworks/JavaScript/fastify/app.js @@ -1,11 +1,11 @@ const cluster = require("cluster"); -const numCPUs = require("os").cpus().length; +const physicalCpuCount = require("physical-cpu-count") if (cluster.isPrimary) { console.log(`Primary ${process.pid} is running`); // Fork workers. - for (let i = 0; i < numCPUs; i++) { + for (let i = 0; i < physicalCpuCount; i++) { cluster.fork(); } diff --git a/frameworks/JavaScript/fastify/fastify-mysql.dockerfile b/frameworks/JavaScript/fastify/fastify-mysql.dockerfile index dce82ff1a90..5a7848d77e2 100644 --- a/frameworks/JavaScript/fastify/fastify-mysql.dockerfile +++ b/frameworks/JavaScript/fastify/fastify-mysql.dockerfile @@ -1,4 +1,4 @@ -FROM node:18.12.1-alpine +FROM node:18.12.1-slim COPY ./ ./ diff --git a/frameworks/JavaScript/fastify/fastify-postgres.dockerfile b/frameworks/JavaScript/fastify/fastify-postgres.dockerfile index 65bf195566d..6d740699084 100644 --- a/frameworks/JavaScript/fastify/fastify-postgres.dockerfile +++ b/frameworks/JavaScript/fastify/fastify-postgres.dockerfile @@ -1,4 +1,4 @@ -FROM node:18.12.1-alpine +FROM node:18.12.1-slim COPY ./ ./ diff --git a/frameworks/JavaScript/fastify/fastify.dockerfile b/frameworks/JavaScript/fastify/fastify.dockerfile index fdd8dcf4946..88c1feef67c 100644 --- a/frameworks/JavaScript/fastify/fastify.dockerfile +++ b/frameworks/JavaScript/fastify/fastify.dockerfile @@ -1,4 +1,4 @@ -FROM node:18.12.1-alpine +FROM node:18.12.1-slim COPY ./ ./ diff --git a/frameworks/JavaScript/fastify/package.json b/frameworks/JavaScript/fastify/package.json index e0740139501..e7f103b0355 100644 --- a/frameworks/JavaScript/fastify/package.json +++ b/frameworks/JavaScript/fastify/package.json @@ -11,6 +11,7 @@ "knex": "2.4.2", "mongodb": "3.5.9", "mysql2": "2.2.5", - "pg": "8.5.1" + "pg": "8.5.1", + "physical-cpu-count": "^2.0.0" } }