# Use the official Node.js image
FROM node:16-alpine

# Set the working directory in the container
RUN addgroup app && adduser -S -G app app
USER app
WORKDIR /app


# Copy package.json and package-lock.json to the container
COPY --chown=app:app package*.json .
# COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the entire application to the container\
COPY --chown=app:app . .

# Build the Next.js application
RUN npm run build

# Expose the port the app will run on
EXPOSE 3011

# Start the application
# CMD ["npm", "run", "dev"]
CMD ["npm", "run", "start:prod"]
