This commit is contained in:
parent
393ecf0c3f
commit
324f4ef0e2
27
Dockerfile
27
Dockerfile
@ -1,26 +1,19 @@
|
||||
FROM fascinated/docker-images:node-pnpm-latest as main
|
||||
|
||||
# Install dependencies only when needed
|
||||
FROM node:20 AS deps
|
||||
FROM main AS deps
|
||||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
||||
#RUN apk add libc6-compat
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies based on the preferred package manager
|
||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
||||
COPY pnpm-lock.yaml* ./
|
||||
|
||||
# Copy cached files
|
||||
#COPY node_modules ./
|
||||
|
||||
#RUN npm i
|
||||
|
||||
RUN \
|
||||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
||||
elif [ -f package-lock.json ]; then npm ci; \
|
||||
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
|
||||
else echo "Lockfile not found." && exit 1; \
|
||||
fi
|
||||
# Install node modules
|
||||
RUN pnpm install --production
|
||||
|
||||
# Rebuild the source code only when needed
|
||||
FROM node:20 AS builder
|
||||
FROM main AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
@ -28,10 +21,10 @@ COPY . .
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
|
||||
# Build the project
|
||||
RUN yarn build
|
||||
RUN pnpm build
|
||||
|
||||
# Production image, copy all the files and run next
|
||||
FROM node:20-alpine AS runner
|
||||
FROM main AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV production
|
||||
@ -49,7 +42,7 @@ 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/public ./.next/static
|
||||
|
||||
RUN npm i -g @beam-australia/react-env
|
||||
RUN pnpm i -g @beam-australia/react-env
|
||||
|
||||
RUN chown -R nextjs:nodejs /app
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
"@beam-australia/react-env": "^3.1.1",
|
||||
"@emotion/cache": "^11.11.0",
|
||||
"@emotion/server": "^11.11.0",
|
||||
"@nextui-org/react": "^2.1.13",
|
||||
"@nextui-org/react": "1.0.0-beta.10",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
||||
"@typescript-eslint/parser": "^6.7.5",
|
||||
"axios": "^1.5.1",
|
||||
|
2084
pnpm-lock.yaml
generated
2084
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user