This commit is contained in:
parent
954b950d18
commit
82300f54eb
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@ -0,0 +1,9 @@
|
||||
node_modules
|
||||
.next
|
||||
.gitignore
|
||||
README.md
|
||||
.dockerignore
|
||||
.git
|
||||
.vscode
|
||||
.idea
|
||||
.github
|
47
Dockerfile
47
Dockerfile
@ -1,42 +1,37 @@
|
||||
FROM node:lts as base
|
||||
# Build stage
|
||||
FROM node:20-slim as builder
|
||||
|
||||
# Set environment variables for pnpm
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable
|
||||
|
||||
WORKDIR /base
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
COPY . .
|
||||
|
||||
# Build stage: build the Next.js application
|
||||
FROM base as build
|
||||
WORKDIR /builder
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
WORKDIR /base
|
||||
COPY . .
|
||||
|
||||
RUN pnpm build
|
||||
|
||||
# Production stage: serve the application
|
||||
FROM node:lts as prod
|
||||
ENV NODE_ENV=production
|
||||
FROM node:20-slim as runner
|
||||
WORKDIR /runner
|
||||
|
||||
WORKDIR /app
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --production
|
||||
|
||||
# Copy build artifacts from the build stage
|
||||
COPY --from=build /base/.next ./.next
|
||||
COPY --from=build /base/public ./public
|
||||
COPY --from=build /base/next.config.mjs ./
|
||||
## Copy build artifacts from the build stage
|
||||
COPY --from=builder /builder/package.json ./
|
||||
#COPY --from=builder /builder/node_modules ./node_modules
|
||||
COPY --from=builder /builder/.next/standalone ./.next/standalone/
|
||||
COPY --from=builder /builder/.next/static ./.next/static
|
||||
COPY --from=builder /builder/public ./public
|
||||
COPY --from=builder /builder/next.config.mjs ./
|
||||
|
||||
# Expose the port for the application
|
||||
#FROM runner as server
|
||||
EXPOSE 3000
|
||||
|
||||
# Copy and configure the entrypoint script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
CMD ["pnpm", "start"]
|
||||
CMD ["pnpm", "start:standalone"]
|
||||
|
@ -4,8 +4,9 @@ import { withPayload } from '@payloadcms/next/withPayload'
|
||||
const nextConfig = {
|
||||
// Your Next.js config here
|
||||
experimental: {
|
||||
reactCompiler: false
|
||||
}
|
||||
reactCompiler: false,
|
||||
},
|
||||
output: 'standalone',
|
||||
}
|
||||
|
||||
export default withPayload(nextConfig)
|
||||
|
@ -13,17 +13,16 @@
|
||||
"lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
|
||||
"ci": "payload migrate && pnpm build",
|
||||
"generate:types": "payload generate:types",
|
||||
"standalone-script": "node ./src/scripts/standalone-script.js"
|
||||
"standalone-script": "node ./standalone-script.js",
|
||||
"start:standalone": "node .next/standalone/server.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.20.2 || >=20.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@payloadcms/db-mongodb": "3.0.0-beta.40",
|
||||
"@payloadcms/db-postgres": "3.0.0-beta.40",
|
||||
"@payloadcms/next": "3.0.0-beta.40",
|
||||
"@payloadcms/richtext-lexical": "3.0.0-beta.40",
|
||||
"@payloadcms/richtext-slate": "3.0.0-beta.40",
|
||||
"@payloadcms/ui": "3.0.0-beta.40",
|
||||
"cross-env": "^7.0.3",
|
||||
"graphql": "^16.8.1",
|
||||
|
9427
pnpm-lock.yaml
9427
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user