FROM node:22.19.0 AS builder

WORKDIR /app
# RUN apk add --no-cache libc6-compat


COPY package*.json ./
RUN npm i


COPY . .

RUN docker build .

#---

FROM node:22.19.0 AS runner

WORKDIR /app


COPY package*.json ./
RUN npm ci --omit=dev

COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package*.json ./

EXPOSE 3000

CMD ["npm", "start"]
