Remove extraneous character from CMD instruction in Dockerfile to ensure proper execution of the start script. This change fixes the command syntax and improves the reliability of the Docker container startup process.
33 lines
615 B
Docker
33 lines
615 B
Docker
# Use Node.js LTS image as the base
|
|
FROM node:current-alpine
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package.json and package-lock.json
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy the application code
|
|
COPY . .
|
|
|
|
# Set IS_BUILD environment variable for build process
|
|
ENV IS_BUILD=true
|
|
|
|
# Build the Next.js application
|
|
RUN npm run build
|
|
|
|
# Unset IS_BUILD environment variable for runtime
|
|
ENV IS_BUILD=false
|
|
|
|
# Set environmental variable for production mode
|
|
ENV NODE_ENV=production
|
|
|
|
# Expose the port the app runs on
|
|
EXPOSE 3000
|
|
|
|
# Run the app with the start script
|
|
CMD ["npm", "start"]
|