chore: modified dockerfiles for space and web (#1987)

This commit is contained in:
Henit Chobisa 2023-08-28 13:37:45 +05:30 committed by GitHub
parent b77ddf9c95
commit cd9cebc7af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -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

View File

@ -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"]
CMD ["node", "app/server.js"]