From cd9cebc7afedc248c68583310dbc38b03fa2cee6 Mon Sep 17 00:00:00 2001 From: Henit Chobisa Date: Mon, 28 Aug 2023 13:37:45 +0530 Subject: [PATCH] chore: modified dockerfiles for space and web (#1987) --- space/Dockerfile.space | 5 ++++- web/Dockerfile.web | 15 +++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/space/Dockerfile.space b/space/Dockerfile.space index 0bdc6e158..b51393000 100644 --- a/space/Dockerfile.space +++ b/space/Dockerfile.space @@ -14,9 +14,12 @@ RUN yarn # Rebuild the source code only when needed FROM base AS builder WORKDIR /space -COPY --from=deps /space/node_modules ./node_modules + COPY . . +COPY --from=deps /space/node_modules ./node_modules +COPY --from=deps /space/yarn.lock . + ENV NEXT_TELEMETRY_DISABLED 1 RUN yarn build diff --git a/web/Dockerfile.web b/web/Dockerfile.web index f14efc571..dad6f017b 100644 --- a/web/Dockerfile.web +++ b/web/Dockerfile.web @@ -8,15 +8,22 @@ WORKDIR /app # Install dependencies based on the preferred package manager COPY package.json yarn.lock .npmrc ./ -RUN yarn - +RUN \ + if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ + elif [ -f package-lock.json ]; then npm ci; \ + else echo "Lockfile not found." && exit 1; \ + fi # Rebuild the source code only when needed FROM base AS builder +RUN apk add --no-cache libc6-compat WORKDIR /app -COPY --from=deps /app/node_modules ./node_modules + COPY . . +COPY --from=deps /app/node_modules ./node_modules +COPY --from=deps /app/yarn.lock . + ENV NEXT_TELEMETRY_DISABLED 1 RUN yarn build @@ -50,4 +57,4 @@ ENV PORT 3000 # set hostname to localhost ENV HOSTNAME "0.0.0.0" -CMD ["node", "web/server.js"] \ No newline at end of file +CMD ["node", "app/server.js"] \ No newline at end of file