This commit is contained in:
parent
f91f56b709
commit
d9f17bb761
10
Dockerfile
10
Dockerfile
@ -1,4 +1,4 @@
|
|||||||
FROM node:20-slim AS base
|
FROM node:lts as base
|
||||||
|
|
||||||
# Set environment variables for pnpm
|
# Set environment variables for pnpm
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
@ -13,15 +13,16 @@ COPY . .
|
|||||||
# Build stage: build the Next.js application
|
# Build stage: build the Next.js application
|
||||||
FROM base as build
|
FROM base as build
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
WORKDIR /base
|
WORKDIR /base
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
# Production stage: serve the application
|
# Production stage: serve the application
|
||||||
FROM node:lts as prod
|
FROM node:lts as prod
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy package files and install production dependencies
|
WORKDIR /app
|
||||||
|
RUN corepack enable
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
RUN pnpm install --production
|
RUN pnpm install --production
|
||||||
|
|
||||||
@ -30,7 +31,10 @@ COPY --from=build /base/.next ./.next
|
|||||||
COPY --from=build /base/public ./public
|
COPY --from=build /base/public ./public
|
||||||
COPY --from=build /base/next.config.js ./
|
COPY --from=build /base/next.config.js ./
|
||||||
|
|
||||||
|
# Expose the port for the application
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Copy and configure the entrypoint script
|
||||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||||
RUN chmod +x /docker-entrypoint.sh
|
RUN chmod +x /docker-entrypoint.sh
|
||||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
Loading…
Reference in New Issue
Block a user