Update Dockerfile
suppress nextra warning? tests
This commit is contained in:
11
Dockerfile
11
Dockerfile
@@ -8,10 +8,13 @@ ENV NODE_OPTIONS="--max-old-space-size=8192"
|
|||||||
# 1. Install dependencies only when needed
|
# 1. Install dependencies only when needed
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
||||||
RUN apk add --no-cache libc6-compat
|
RUN apk add --no-cache libc6-compat git
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Initialize git repository to prevent Nextra warnings
|
||||||
|
RUN git init
|
||||||
|
|
||||||
# Install dependencies based on the preferred package manager
|
# Install dependencies based on the preferred package manager
|
||||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
|
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
|
||||||
RUN \
|
RUN \
|
||||||
@@ -27,6 +30,8 @@ FROM base AS builder
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
|
# Initialize git repository in builder stage as well
|
||||||
|
RUN git init
|
||||||
# This will do the trick, use the corresponding env file for each environment.
|
# This will do the trick, use the corresponding env file for each environment.
|
||||||
# COPY .env.production.sample .env.production
|
# COPY .env.production.sample .env.production
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
@@ -47,6 +52,10 @@ COPY --from=builder /app/public ./public
|
|||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
|
||||||
|
# Initialize git repository in production stage
|
||||||
|
RUN apk add --no-cache git && \
|
||||||
|
git init && \
|
||||||
|
chown -R nextjs:nodejs .git
|
||||||
|
|
||||||
USER nextjs
|
USER nextjs
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user