From fb3db283e8242b8a875e6433ecc63f096c8d844d Mon Sep 17 00:00:00 2001 From: Sameer Kumar Subudhi Date: Mon, 19 Feb 2024 19:36:01 +0530 Subject: [PATCH] :whale: Update Dockerfile to read node version from .nvmrc --- Makefile | 22 ++++++++++----------- README.md | 2 +- services/blockchain-app-registry/Dockerfile | 6 ++++-- services/blockchain-connector/Dockerfile | 6 ++++-- services/blockchain-coordinator/Dockerfile | 6 ++++-- services/blockchain-indexer/Dockerfile | 6 ++++-- services/export/Dockerfile | 6 ++++-- services/fee-estimator/Dockerfile | 6 ++++-- services/gateway/Dockerfile | 6 ++++-- services/market/Dockerfile | 6 ++++-- services/template/Dockerfile | 6 ++++-- services/transaction-statistics/Dockerfile | 6 ++++-- tests/Dockerfile | 6 ++++-- 13 files changed, 56 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index b950497b1a..e4b7c30107 100644 --- a/Makefile +++ b/Makefile @@ -77,37 +77,37 @@ build-images: build-app-registry build-connector build-indexer build-coordinator build-all: build build-template build-tests build-app-registry: - cd ./services/blockchain-app-registry && docker buildx build --tag=lisk/service_blockchain_app_registry ./ + cd ./services/blockchain-app-registry && docker buildx build --build-arg NODEJS_VERSION=$(shell cat .nvmrc) --tag=lisk/service_blockchain_app_registry ./ build-connector: - cd ./services/blockchain-connector && docker buildx build --tag=lisk/service_blockchain_connector ./ + cd ./services/blockchain-connector && docker buildx build --build-arg NODEJS_VERSION=$(shell cat .nvmrc) --tag=lisk/service_blockchain_connector ./ build-indexer: - cd ./services/blockchain-indexer && docker buildx build --tag=lisk/service_blockchain_indexer ./ + cd ./services/blockchain-indexer && docker buildx build --build-arg NODEJS_VERSION=$(shell cat .nvmrc) --tag=lisk/service_blockchain_indexer ./ build-coordinator: - cd ./services/blockchain-coordinator && docker buildx build --tag=lisk/service_blockchain_coordinator ./ + cd ./services/blockchain-coordinator && docker buildx build --build-arg NODEJS_VERSION=$(shell cat .nvmrc) --tag=lisk/service_blockchain_coordinator ./ build-statistics: - cd ./services/transaction-statistics && docker buildx build --tag=lisk/service_transaction_statistics ./ + cd ./services/transaction-statistics && docker buildx build --build-arg NODEJS_VERSION=$(shell cat .nvmrc) --tag=lisk/service_transaction_statistics ./ build-fees: - cd ./services/fee-estimator && docker buildx build --tag=lisk/service_fee_estimator ./ + cd ./services/fee-estimator && docker buildx build --build-arg NODEJS_VERSION=$(shell cat .nvmrc) --tag=lisk/service_fee_estimator ./ build-market: - cd ./services/market && docker buildx build --tag=lisk/service_market ./ + cd ./services/market && docker buildx build --build-arg NODEJS_VERSION=$(shell cat .nvmrc) --tag=lisk/service_market ./ build-export: - cd ./services/export && docker buildx build --tag=lisk/service_export ./ + cd ./services/export && docker buildx build --build-arg NODEJS_VERSION=$(shell cat .nvmrc) --tag=lisk/service_export ./ build-gateway: - cd ./services/gateway && docker buildx build --tag=lisk/service_gateway ./ + cd ./services/gateway && docker buildx build --build-arg NODEJS_VERSION=$(shell cat .nvmrc) --tag=lisk/service_gateway ./ build-template: - cd ./services/template && docker buildx build --tag=lisk/service_template ./ + cd ./services/template && docker buildx build --build-arg NODEJS_VERSION=$(shell cat .nvmrc) --tag=lisk/service_template ./ build-tests: - cd ./tests && docker buildx build --tag=lisk/service_tests ./ + cd ./tests && docker buildx build --build-arg NODEJS_VERSION=$(shell cat .nvmrc) --tag=lisk/service_tests ./ build-local: yarn install --frozen-lockfile diff --git a/README.md b/README.md index e4d112e122..083942d180 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ WebSocket-based APIs can be used through the [Socket.IO](https://socket.io/) lib To continue the installation ensure that you have the following dependencies installed: -- [NodeJS Active LTS - ^v18.16](https://nodejs.org/en/about/releases/) +- [NodeJS Active LTS - ^v18.19.1](https://nodejs.org/en/about/releases/) - [MySQL - ^v8.0.29](https://dev.mysql.com/doc/relnotes/mysql/8.0/en/) - [Docker](https://www.docker.com/) with [Docker compose](https://docs.docker.com/compose/install/) - [GNU Make](https://www.gnu.org/software/make/) and [GNU Tar](https://www.gnu.org/software/tar/) diff --git a/services/blockchain-app-registry/Dockerfile b/services/blockchain-app-registry/Dockerfile index b2366182fd..fcfaab17be 100644 --- a/services/blockchain-app-registry/Dockerfile +++ b/services/blockchain-app-registry/Dockerfile @@ -1,6 +1,8 @@ +ARG NODEJS_VERSION=18 + ##### Stage 1 -FROM node:18-alpine AS builder +FROM node:$NODEJS_VERSION-alpine AS builder RUN adduser -D builder && \ mkdir /home/builder/build && \ @@ -15,7 +17,7 @@ RUN yarn install --frozen-lockfile ##### Stage 2 -FROM node:18-alpine +FROM node:$NODEJS_VERSION-alpine RUN mkdir -p /home/lisk/lisk-service/blockchain-app-registry/data && \ adduser -D lisk && \ diff --git a/services/blockchain-connector/Dockerfile b/services/blockchain-connector/Dockerfile index 2c1acf56b3..29952b4ef1 100644 --- a/services/blockchain-connector/Dockerfile +++ b/services/blockchain-connector/Dockerfile @@ -1,6 +1,8 @@ +ARG NODEJS_VERSION=18 + ##### Stage 1 -FROM node:18-alpine AS builder +FROM node:$NODEJS_VERSION-alpine AS builder RUN apk add --no-cache alpine-sdk=~1 python3=~3 cmake=~3 && \ adduser -D builder && \ @@ -16,7 +18,7 @@ RUN yarn install --frozen-lockfile ##### Stage 2 -FROM node:18-alpine +FROM node:$NODEJS_VERSION-alpine RUN mkdir -p /home/lisk/lisk-service/blockchain-connector/data && \ adduser -D lisk && \ diff --git a/services/blockchain-coordinator/Dockerfile b/services/blockchain-coordinator/Dockerfile index 2c2fccbccc..825d1b00c8 100644 --- a/services/blockchain-coordinator/Dockerfile +++ b/services/blockchain-coordinator/Dockerfile @@ -1,6 +1,8 @@ +ARG NODEJS_VERSION=18 + ##### Stage 1 -FROM node:18-alpine AS builder +FROM node:$NODEJS_VERSION-alpine AS builder RUN adduser -D builder && \ mkdir /home/builder/build && \ @@ -15,7 +17,7 @@ RUN yarn install --frozen-lockfile ##### Stage 2 -FROM node:18-alpine +FROM node:$NODEJS_VERSION-alpine RUN adduser -D lisk && \ chown -R lisk:lisk /home/lisk/ diff --git a/services/blockchain-indexer/Dockerfile b/services/blockchain-indexer/Dockerfile index 7096568ea3..9a0dc68aa5 100644 --- a/services/blockchain-indexer/Dockerfile +++ b/services/blockchain-indexer/Dockerfile @@ -1,6 +1,8 @@ +ARG NODEJS_VERSION=18 + ##### Stage 1 -FROM node:18-alpine AS builder +FROM node:$NODEJS_VERSION-alpine AS builder RUN adduser -D builder && \ mkdir /home/builder/build && \ @@ -15,7 +17,7 @@ RUN yarn install --frozen-lockfile ##### Stage 2 -FROM node:18-alpine +FROM node:$NODEJS_VERSION-alpine RUN apk update && apk add --no-cache mysql-client=~10 && \ mkdir -p /home/lisk/lisk-service/blockchain-indexer/data && \ diff --git a/services/export/Dockerfile b/services/export/Dockerfile index 18b8ed8455..202663b762 100644 --- a/services/export/Dockerfile +++ b/services/export/Dockerfile @@ -1,6 +1,8 @@ +ARG NODEJS_VERSION=18 + ##### Stage 1 -FROM node:18-alpine AS builder +FROM node:$NODEJS_VERSION-alpine AS builder RUN adduser -D builder && \ mkdir /home/builder/build && \ @@ -15,7 +17,7 @@ RUN yarn install --frozen-lockfile ##### Stage 2 -FROM node:18-alpine +FROM node:$NODEJS_VERSION-alpine RUN mkdir -p /home/lisk/lisk-service/export/data && \ adduser -D lisk && \ diff --git a/services/fee-estimator/Dockerfile b/services/fee-estimator/Dockerfile index 323d488b48..e2a1efa0d8 100644 --- a/services/fee-estimator/Dockerfile +++ b/services/fee-estimator/Dockerfile @@ -1,6 +1,8 @@ +ARG NODEJS_VERSION=18 + ##### Stage 1 -FROM node:18-alpine AS builder +FROM node:$NODEJS_VERSION-alpine AS builder RUN adduser -D builder && \ mkdir /home/builder/build && \ @@ -14,7 +16,7 @@ RUN yarn install --frozen-lockfile ##### Stage 2 -FROM node:18-alpine +FROM node:$NODEJS_VERSION-alpine RUN adduser -D lisk && \ chown -R lisk:lisk /home/lisk/ diff --git a/services/gateway/Dockerfile b/services/gateway/Dockerfile index 872381e47d..c17bacdb0d 100644 --- a/services/gateway/Dockerfile +++ b/services/gateway/Dockerfile @@ -1,6 +1,8 @@ +ARG NODEJS_VERSION=18 + ##### Stage 1 -FROM node:18-alpine AS builder +FROM node:$NODEJS_VERSION-alpine AS builder RUN adduser -D builder && \ mkdir /home/builder/build && \ @@ -17,7 +19,7 @@ RUN yarn install --frozen-lockfile && \ ##### Stage 2 -FROM node:18-alpine +FROM node:$NODEJS_VERSION-alpine RUN apk add --no-cache curl=~8 && \ adduser -D lisk diff --git a/services/market/Dockerfile b/services/market/Dockerfile index 01d94c5c48..5a6fa9f633 100644 --- a/services/market/Dockerfile +++ b/services/market/Dockerfile @@ -1,6 +1,8 @@ +ARG NODEJS_VERSION=18 + ##### Stage 1 -FROM node:18-alpine AS builder +FROM node:$NODEJS_VERSION-alpine AS builder RUN adduser -D builder && \ mkdir /home/builder/build && \ @@ -15,7 +17,7 @@ RUN yarn install --frozen-lockfile ##### Stage 2 -FROM node:18-alpine +FROM node:$NODEJS_VERSION-alpine RUN adduser -D lisk && \ chown -R lisk:lisk /home/lisk/ diff --git a/services/template/Dockerfile b/services/template/Dockerfile index 70632d2ba3..3153f42d31 100644 --- a/services/template/Dockerfile +++ b/services/template/Dockerfile @@ -1,6 +1,8 @@ +ARG NODEJS_VERSION=18 + ##### Stage 1 -FROM node:18-alpine AS builder +FROM node:$NODEJS_VERSION-alpine AS builder RUN adduser -D builder && \ mkdir /home/builder/build && \ @@ -15,7 +17,7 @@ RUN yarn install --frozen-lockfile ##### Stage 2 -FROM node:18-alpine +FROM node:$NODEJS_VERSION-alpine RUN adduser -D lisk && \ chown -R lisk:lisk /home/lisk/ diff --git a/services/transaction-statistics/Dockerfile b/services/transaction-statistics/Dockerfile index 5518d9252d..3f4d69275f 100644 --- a/services/transaction-statistics/Dockerfile +++ b/services/transaction-statistics/Dockerfile @@ -1,6 +1,8 @@ +ARG NODEJS_VERSION=18 + ##### Stage 1 -FROM node:18-alpine AS builder +FROM node:$NODEJS_VERSION-alpine AS builder RUN adduser -D builder && \ mkdir /home/builder/build && \ @@ -15,7 +17,7 @@ RUN yarn install --frozen-lockfile ##### Stage 2 -FROM node:18-alpine +FROM node:$NODEJS_VERSION-alpine RUN adduser -D lisk && \ chown -R lisk:lisk /home/lisk/ diff --git a/tests/Dockerfile b/tests/Dockerfile index b72f0a44cc..24a251c35f 100644 --- a/tests/Dockerfile +++ b/tests/Dockerfile @@ -1,6 +1,8 @@ +ARG NODEJS_VERSION=18 + ##### Stage 1 -FROM node:18-alpine AS builder +FROM node:$NODEJS_VERSION-alpine AS builder RUN adduser -D builder && \ mkdir /home/builder/build && \ @@ -14,7 +16,7 @@ RUN yarn install --frozen-lockfile ##### Stage 2 -FROM node:18-alpine +FROM node:$NODEJS_VERSION-alpine RUN adduser -D lisk && \ chown -R lisk:lisk /home/lisk/