mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2025-12-08 17:32:27 +08:00
feat(docker): Docker build with multi-stage
This will significantly reduce the size of the final image used for deployment.
This commit is contained in:
17
Dockerfile
17
Dockerfile
@ -1,12 +1,17 @@
|
|||||||
FROM --platform=linux/amd64 node:19-bullseye-slim
|
FROM node:22-alpine AS deps
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN yarn install --frozen-lockfile
|
||||||
|
|
||||||
RUN yarn install
|
FROM deps AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
|
FROM node:22-alpine AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
CMD ["node", "server.js"]
|
||||||
CMD ["yarn","start"]
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ const nextConfig = {
|
|||||||
// https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors
|
// https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors
|
||||||
ignoreBuildErrors: true,
|
ignoreBuildErrors: true,
|
||||||
},
|
},
|
||||||
|
output: 'standalone',
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = nextConfig
|
module.exports = nextConfig
|
||||||
|
|||||||
Reference in New Issue
Block a user