From 1bef7587cccada6df48cfa3d208bf123a5d00c30 Mon Sep 17 00:00:00 2001 From: towfiqi Date: Sun, 10 Nov 2024 12:54:32 +0600 Subject: [PATCH] fix: Fixes Docker build issue. --- Dockerfile | 15 ++++++++++----- components/keywords/KeywordFilter.tsx | 5 ++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index bdb0e90..e491ef1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ -FROM node:lts-alpine AS deps - +FROM node:22.11.0-alpine3.20 AS deps +ENV NPM_VERSION=10.3.0 +RUN npm install -g npm@"${NPM_VERSION}" WORKDIR /app COPY package.json ./ @@ -7,8 +8,10 @@ RUN npm install COPY . . -FROM node:lts-alpine AS builder +FROM node:22.11.0-alpine3.20 AS builder WORKDIR /app +ENV NPM_VERSION=10.3.0 +RUN npm install -g npm@"${NPM_VERSION}" COPY --from=deps /app ./ RUN rm -rf /app/data RUN rm -rf /app/__tests__ @@ -16,9 +19,11 @@ RUN rm -rf /app/__mocks__ RUN npm run build -FROM node:lts-alpine AS runner +FROM node:22.11.0-alpine3.20 AS runner WORKDIR /app -ENV NODE_ENV production +ENV NPM_VERSION=10.3.0 +RUN npm install -g npm@"${NPM_VERSION}" +ENV NODE_ENV=production RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs RUN set -xe && mkdir -p /app/data && chown nextjs:nodejs /app/data diff --git a/components/keywords/KeywordFilter.tsx b/components/keywords/KeywordFilter.tsx index 1c6da6d..9d6d9af 100644 --- a/components/keywords/KeywordFilter.tsx +++ b/components/keywords/KeywordFilter.tsx @@ -66,7 +66,10 @@ const KeywordFilters = (props: KeywordFilterProps) => { const optionObject:{label:string, value:string}[] = []; if (!isConsole) { - const allCountries = keywords.reduce((acc: string[], keyword) => [...acc, keyword.country], []).filter((t) => t && t.trim() !== ''); + const allCountries = Array.from(keywords as KeywordType[]) + .map((keyword) => keyword.country) + .reduce((acc, country) => [...acc, country], []) + .filter((t) => t && t.trim() !== ''); [...new Set(allCountries)].forEach((c) => optionObject.push({ label: countries[c][0], value: c })); } else { Object.keys(countries).forEach((countryISO:string) => {