FROM node:24-alpine
WORKDIR /app

# Install Playwright system dependencies
RUN apk add --no-cache \
    chromium \
    font-liberation \
    font-noto \
    font-noto-cjk

COPY package*.json ./
RUN npm ci

COPY . .
RUN npm run build

EXPOSE 3000
ENV NODE_ENV=production

# Declare volume for Instagram authentication persistence
VOLUME ["/app/secrets"]

CMD ["node", "-e", "import('./build/index.js')"]