-
Notifications
You must be signed in to change notification settings - Fork 125
feat: Update docker file #1225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Update docker file #1225
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,53 +1,41 @@ | ||
| FROM node:18-alpine AS base | ||
|
|
||
| RUN apk update | ||
| RUN apk --no-cache add git | ||
| # 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 | ||
|
|
||
| # Install dependencies only when needed | ||
| FROM base AS deps | ||
| WORKDIR /app | ||
|
|
||
| # Install dependencies based on the preferred package manager | ||
| COPY package.json package-lock.json ./ | ||
| RUN npm ci | ||
| RUN npm run install-idl | ||
|
|
||
|
|
||
| FROM node:18-bookworm-slim AS base | ||
|
|
||
| FROM base AS dev | ||
|
|
||
| # Install git + CA bundle so git https can verify TLS | ||
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends git ca-certificates | ||
| WORKDIR /app | ||
| COPY --from=deps /app/node_modules ./node_modules | ||
| COPY . . | ||
gitar-bot[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
|
|
||
| # Rebuild the source code only when needed | ||
| FROM base AS builder | ||
| WORKDIR /app | ||
| COPY --from=deps /app/node_modules ./node_modules | ||
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends git ca-certificates | ||
gitar-bot[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| COPY package.json package-lock.json ./ | ||
| RUN npm ci | ||
| RUN npm run install-idl | ||
| COPY . . | ||
|
|
||
| # Next.js collects completely anonymous telemetry data about general usage. | ||
| # Learn more here: https://nextjs.org/telemetry | ||
| # Uncomment the following line in case you want to disable telemetry during the build. | ||
| ENV NEXT_TELEMETRY_DISABLED 1 | ||
| ENV NEXT_TELEMETRY_DISABLED=1 | ||
|
||
| # optimize Build size by including only required resources | ||
|
|
||
|
|
||
| RUN npm run generate:idl | ||
| RUN npm run build | ||
| RUN npm run build-standalone | ||
| RUN npm run post-build-standalone | ||
|
|
||
| # Production image, copy all the files and run next | ||
| # Production image, copy necessary files and run next | ||
| FROM base AS runner | ||
| WORKDIR /app | ||
|
|
||
| ENV NODE_ENV production | ||
| ENV NODE_ENV=production | ||
| # Uncomment the following line in case you want to disable telemetry during runtime. | ||
| ENV NEXT_TELEMETRY_DISABLED 1 | ||
| ENV NEXT_TELEMETRY_DISABLED=1 | ||
adhityamamallan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| RUN addgroup --system --gid 1001 nodejs | ||
| RUN adduser --system --uid 1001 nextjs | ||
|
|
@@ -61,7 +49,7 @@ RUN chown nextjs:nodejs .next | |
|
|
||
| # Automatically leverage output traces to reduce image size | ||
| # https://nextjs.org/docs/advanced-features/output-file-tracing | ||
| COPY --from=builder --chown=nextjs:nodejs /app/src/__generated__/ ./src/__generated__/ | ||
| COPY --from=builder --chown=nextjs:nodejs /app/src/__generated__/ ./src/__generated__/ | ||
| COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
| COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.