FROM node:16

# Set the working directory inside the container
WORKDIR /usr/src/app

# Copy package.json and package-lock.json (if available) to the working directory
COPY package*.json ./

# Install application dependencies
RUN npm install && npm install -g nodemon

# Copy the rest of the application to the working directory
COPY . .

# Expose the port the app runs on
EXPOSE 5000

# Change permissions for the 'public' directory to allow write access
RUN chmod -R 777 /usr/src/app/public

# Command to run the application
CMD [ "npm", "start" ]