KingNish's picture
Create Dockerfile
c49cf7f verified
raw
history blame
455 Bytes
# 1. Base image with Node.js
FROM node:18-alpine
# 2. Set working directory inside the container
WORKDIR /app
# 3. Copy package files and install dependencies
COPY package.json package-lock.json* ./
RUN npm install
# 4. Copy all other source files
COPY . .
# 5. Build the Next.js app
RUN npm run build
# 6. Set environment variable for the custom port
ENV PORT=7860
# 7. Expose port 7860
EXPOSE 7860
# 8. Start the Next.js app
CMD ["npm", "start"]