Skip to content
Extraits de code Groupes Projets
Valider eb40b9ce rédigé par oussama aftys's avatar oussama aftys
Parcourir les fichiers

updated Dockerfile

parent b2c386d0
Branches
Aucune requête de fusion associée trouvée
node_modules # Node modules and build directories
\ No newline at end of file node_modules
.next
# IDE and editor settings
.vscode
.idea
# System files
.DS_Store
# Git repository files
.git
.gitignore
# Logs and temporary files
*.log
*.tmp
*.swp
# Miscellaneous
npm-debug.log*
yarn-debug.log*
yarn-error.log*
\ No newline at end of file
ARG ARCH=linux/amd64 # Stage 1: Install dependencies and build
FROM node:18-alpine AS builder
FROM --platform=$ARCH node:18
# Set the working directory
WORKDIR /app WORKDIR /app
# Copy only the dependency files
COPY package*.json ./ COPY package*.json ./
# Install all dependencies
RUN npm install RUN npm install
# Copy the rest of the application
COPY . . COPY . .
RUN npm run build # Build the Next.js app
RUN npm run build
# Stage 2: Runtime
FROM node:18-alpine AS runtime
# Set the working directory
WORKDIR /app
# Copy only the production dependencies from the builder
COPY --from=builder /app/node_modules ./node_modules
# Copy the build output and public assets
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/package*.json ./
# Expose the application port
EXPOSE 3000 EXPOSE 3000
# Start the Next.js application
CMD ["npm", "start"] CMD ["npm", "start"]
0% ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter