From 0eaa4ce42a1e48f9854605788bdacaf538088f22 Mon Sep 17 00:00:00 2001 From: Howard Gao Date: Thu, 31 Oct 2024 19:20:00 +0800 Subject: [PATCH] [#24] Improve dependencies install in Dockerfile --- Dockerfile | 23 ++++++----------------- package.json | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/Dockerfile b/Dockerfile index c195cec..eb5a71a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,29 +26,18 @@ RUN yarn install --network-timeout 1000000 ## Build application RUN yarn build -FROM registry.access.redhat.com/ubi8/nodejs-20-minimal:latest +## Gather productization dependencies +RUN yarn install --network-timeout 1000000 --modules-folder node_modules_prod --production -USER root +FROM registry.access.redhat.com/ubi8/nodejs-20-minimal:latest COPY --from=BUILD_IMAGE /usr/src/app/dist /usr/share/amq-spp/dist COPY --from=BUILD_IMAGE /usr/src/app/.env /usr/share/amq-spp/.env +COPY --from=BUILD_IMAGE /usr/src/app/node_modules_prod /usr/share/amq-spp/node_modules WORKDIR /usr/share/amq-spp -RUN npm install connect \ -cors \ -express \ -express-openapi-validator \ -swagger-routes-express \ -typescript \ -validator \ -yaml \ -base-64 \ -jsonwebtoken \ -dotenv \ -express-rate-limit \ -node-fetch@2 \ -@peculiar/x509 +USER root RUN echo "node /usr/share/amq-spp/dist/app.js" > run.sh RUN chmod +x run.sh @@ -63,4 +52,4 @@ CMD ["node", "dist/app.js"] LABEL name="artemiscloud/activemq-artemis-jolokia-api-server" LABEL description="ActiveMQ Artemis Jolokia api-server" LABEL maintainer="Howard Gao " -LABEL version="0.1.1" \ No newline at end of file +LABEL version="0.1.1" diff --git a/package.json b/package.json index 7c6abea..f8ffa13 100644 --- a/package.json +++ b/package.json @@ -42,43 +42,43 @@ "@types/webpack": "5.28.1", "@typescript-eslint/eslint-plugin": "^5.14.0", "@typescript-eslint/parser": "^5.14.0", - "base-64": "^1.0.0", "chromatic": "6.10.1", "copy-webpack-plugin": "11.0.0", - "cors": "^2.8.5", - "dotenv": "^16.4.5", "eslint": "^8.10.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-unused-imports": "^3.2.0", - "express": "4.18.2", - "express-openapi-validator": "5.1.2", - "express-rate-limit": "^7.2.0", "husky": "8.0.0", "jest": "^27.5.1", "jest-environment-jsdom": "^27.5.1", - "js-yaml": "4.1.0", - "jsonwebtoken": "^9.0.2", "lint-staged": "13.1.0", "nock": "^13.5.4", - "node-fetch": "2", "openapi-to-md": "^1.0.24", "pluralize": "^8.0.0", "prettier": "^2.7.1", "prettier-stylelint": "^0.4.2", "pretty-quick": "3.1.3", "sort-package-json": "^2.10.0", - "swagger-routes-express": "^3.3.2", "ts-jest": "^29.2.1", "ts-loader": "^9.3.1", "ts-node": "10.9.2", - "typescript": "^4.7.4", - "yaml": "^2.4.5" + "typescript": "^4.7.4" }, "readme": "README.md", "_id": "activemq-artemis-jolokia-api-server@0.1.1", "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e", "dependencies": { + "cors": "^2.8.5", + "base-64": "^1.0.0", + "dotenv": "^16.4.5", + "express": "4.18.2", + "express-openapi-validator": "5.1.2", + "express-rate-limit": "^7.2.0", + "yaml": "^2.4.5", + "js-yaml": "4.1.0", + "jsonwebtoken": "^9.0.2", + "node-fetch": "2", + "swagger-routes-express": "^3.3.2", "express-pino-logger": "^7.0.0", "pino": "^9.5.0" }