# Müco Mutfak — statik site + admin API tek container
# Sunucu, açılışta PUBLISH_ON_BOOT=true ile DB'den güncel içeriği çekip build alır.
FROM node:22-alpine

WORKDIR /app

RUN corepack enable

COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

COPY . .

# İlk build (repo'daki JSON'larla) — boot'ta DB içeriğiyle yenilenir
RUN yarn build

ENV NODE_ENV=production
ENV ADMIN_PORT=3001
ENV PUBLISH_ON_BOOT=true

EXPOSE 3001

CMD ["node", "server/index.mjs"]
