Init working UI
This commit is contained in:
35
Dockerfile
35
Dockerfile
@@ -11,7 +11,7 @@ RUN npm ci
|
||||
# COPY package.json yarn.lock ./
|
||||
# RUN yarn install --frozen-lockfile
|
||||
|
||||
# Stage 2: Build the Next.js application
|
||||
# Stage 2: Build the Next.js application (production build)
|
||||
FROM node:22-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
@@ -19,32 +19,33 @@ WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
# Build the Next.js application
|
||||
# This will create the .next directory with optimized production build
|
||||
# Build the Next.js application for production
|
||||
ENV NODE_ENV production
|
||||
RUN npm run build
|
||||
|
||||
# Stage 3: Run the Next.js application in production
|
||||
# Stage 3: Run the Next.js application (flexible for dev and prod)
|
||||
FROM node:22-alpine AS runner
|
||||
WORKDIR /app
|
||||
|
||||
# Set environment variables for Next.js production server
|
||||
ENV NODE_ENV production
|
||||
|
||||
# Next.js requires specific environment variables for standalone output
|
||||
# If you are using `output: 'standalone'` in next.config.js, uncomment the following:
|
||||
# ENV NEXT_SHARP_PATH=/usr/local/lib/node_modules/sharp
|
||||
# COPY --from=builder /app/.next/standalone ./
|
||||
# COPY --from=builder /app/.next/static ./.next/static
|
||||
# COPY --from=builder /app/public ./public
|
||||
|
||||
# If not using standalone output, copy the necessary files
|
||||
COPY --from=builder /app/public ./public
|
||||
# Copy necessary files for both development and production
|
||||
COPY --from=builder /app/src/public ./public
|
||||
COPY --from=builder /app/.next ./.next
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/package.json ./package.json
|
||||
|
||||
# If you are using `output: 'standalone'` in next.config.js, uncomment the following:
|
||||
# ENV NEXT_SHARP_PATH=/usr/local/lib/node_modules/sharp
|
||||
# COPY --from=builder /app/.next/standalone ./
|
||||
# COPY --from=builder /app/.next/static ./.next/static
|
||||
# COPY --from=builder /app/public ./public # Already copied above, but keep if standalone specific
|
||||
|
||||
# Expose the port Next.js runs on (default is 3000)
|
||||
EXPOSE 3000
|
||||
|
||||
# Argument to set NODE_ENV at runtime
|
||||
ARG NODE_ENV=production
|
||||
ENV NODE_ENV ${NODE_ENV}
|
||||
|
||||
# Command to run the Next.js application
|
||||
CMD ["npm", "start"]
|
||||
# This will run 'npm run dev' if NODE_ENV is 'development', otherwise 'npm start' (production)
|
||||
CMD ["sh", "-c", "if [ \"$NODE_ENV\" = \"development\" ]; then npm run dev; else npm start; fi"]
|
||||
Reference in New Issue
Block a user