# Use an official Node.js runtime as a parent image
FROM node:18-alpine

# Install Python, make, and g++ to allow native module compilation
RUN apk add --no-cache python3 make g++

# Set the working directory inside the container
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY ["package.json", "package-lock.json", "./"]

# Install dependencies
RUN npm install
RUN npm rebuild bcrypt 
RUN npm install nodemon -g

# Copy the rest of the application source code
COPY . .

# Expose the port your Express app runs on
EXPOSE 3001

# Command to run your app
CMD ["nodemon"]

# sudo docker build -t emi-backend .
# sudo docker run -d -p 4000:5000 -e PORT=5000 emi-backend