FROM node:22-alpine

# Set working directory
WORKDIR /app

# Copy package.json und package-lock.json zuerst, um den Cache zu nutzen
COPY package.json package-lock.json ./

# Installiere alle Abhängigkeiten
RUN npm install

# Kopiere den Rest der Anwendung
COPY . .

# Baue die Next.js-Anwendung
RUN npm run build

# Expose the port your Next.js app runs on
EXPOSE 3050

# Start the Next.js server
CMD ["npm", "run", "start"]