# Use the official Node.js image as the base | |
FROM node:18 AS build | |
# Set the working directory inside the container | |
WORKDIR /app | |
# Copy the entire project to the working directory | |
COPY . . | |
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ | |
apt-get install -y nodejs | |
COPY package*.json ./ | |
COPY src ./src | |
RUN npm install react-icons | |
RUN npm install | |
# Set the ownership of the /app directory to the node user | |
RUN chown -R node:node /app | |
# Expose the desired port | |
EXPOSE 7860 | |
# Switch to the node user | |
USER node | |
# Start the application | |
CMD ["npm", "run", "dev", "--", "--host"] |