27 lines
519 B
Docker
27 lines
519 B
Docker
# Use Node.js 22 as the base image
|
|
FROM node:22-alpine
|
|
|
|
# Set working directory
|
|
WORKDIR /application
|
|
|
|
# Copy package files first
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# Copy the rest of the application
|
|
COPY . .
|
|
|
|
# Build the Next.js application
|
|
RUN npm run build
|
|
|
|
# Expose port 3000
|
|
EXPOSE 3000
|
|
|
|
# Set environment variable
|
|
ENV NODE_ENV production
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
|
|
|
# Start the application and keep the container running even if it fails
|
|
CMD ["sh", "-c", "npm start || tail -f /dev/null"] |