mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2025-12-08 09:12:29 +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
|
||||
|
||||
COPY . .
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
RUN yarn install
|
||||
FROM deps AS builder
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
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
|
||||
|
||||
CMD ["yarn","start"]
|
||||
CMD ["node", "server.js"]
|
||||
|
||||
@ -16,6 +16,7 @@ const nextConfig = {
|
||||
// https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors
|
||||
ignoreBuildErrors: true,
|
||||
},
|
||||
output: 'standalone',
|
||||
}
|
||||
|
||||
module.exports = nextConfig
|
||||
|
||||
Reference in New Issue
Block a user