diff --git a/netmanager-app/Dockerfile b/netmanager-app/Dockerfile index a67f97c6c2..1e755865ee 100644 --- a/netmanager-app/Dockerfile +++ b/netmanager-app/Dockerfile @@ -1,20 +1,31 @@ # Use the official Node.js image as a base -FROM node:18 +FROM node:18-alpine AS builder # Set the working directory WORKDIR /app +COPY --from=builder /app/.next ./.next +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package*.json ./ + # Copy package.json and package-lock.json COPY package*.json ./ -# Install dependencies -RUN npm install +RUN npm ci # Copy the rest of the application code COPY . . +RUN npm run build + +# Add healthcheck +HEALTHCHECK --interval=30s --timeout=3s \ + CMD wget --no-verbose --tries=1 --spider http://localhost:3000/ || exit 1 + +USER node + # Expose the application port EXPOSE 3000 # Command to run the application -CMD ["npm", "start"] \ No newline at end of file +CMD ["npm", "run", "start"] \ No newline at end of file