-
|
Hi, I am having some troubles converting the standard this is the base Dockerfile: FROM node:18-alpine AS base
FROM base AS builder
RUN apk add --no-cache libc6-compat
RUN apk update
# Set working directory
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN turbo prune --scope=web --docker
# Add lockfile and package.json's of isolated subworkspace
FROM base AS installer
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /app
# First install the dependencies (as they change less often)
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN yarn install
# Build the project
COPY --from=builder /app/out/full/ .
RUN yarn turbo run build --filter=web...
FROM base AS runner
WORKDIR /app
# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs
COPY --from=installer /app/apps/web/next.config.js .
COPY --from=installer /app/apps/web/package.json .
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public
CMD node apps/web/server.jsyou can find the repo for my project here Is someone able to help? Thank you |
Beta Was this translation helpful? Give feedback.
Answered by
KeJunMao
Jun 9, 2023
Replies: 1 comment
-
|
This demonstrates how to use pnpm, this is a Dockerfile for the nuxt app FROM node:18-alpine as base
ARG APP_NAME
WORKDIR /app
FROM base as pnpm
RUN corepack enable
FROM base as workspace
RUN yarn global add turbo
COPY . .
RUN turbo prune --scope $APP_NAME --docker
FROM pnpm AS builder
COPY .gitignore .gitignore
COPY --from=workspace /app/out/json/ .
COPY --from=workspace /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN pnpm install
COPY --from=workspace /app/out/full/ .
RUN pnpm exec turbo run build --filter=$APP_NAME...
FROM base
COPY --from=builder /app/apps/$APP_NAME/.output .output
EXPOSE 3000
CMD ["node", "/app/.output/server/index.mjs"] |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
anthonyshew
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This demonstrates how to use pnpm, this is a Dockerfile for the nuxt app