# syntax=docker/dockerfile:1
FROM gcr.io/distroless/cc-debian12

WORKDIR /app

# Copy sibling dependencies referenced by package.json
COPY dashdbschema /dashdbschema
COPY llmorbiter /llmorbiter

# Copy application runtime files and SEA binary
COPY dashback/node_modules ./node_modules
COPY dashback/package.json ./package.json
COPY dashback/src ./src
COPY dashback/dist/dashback ./dist/dashback

# Set production defaults: port 4202 only, localhost only
ENV NODE_ENV=production \
    HOST=127.0.0.1 \
    PORT=4202 \
    HTTPS_PORT=0 \
    SQLITE_PATH=/app/data/dash.db \
    STORAGE_DIR=/app/data/storage \
    BACKUP_DIR=/app/data/backups

EXPOSE 4202

CMD ["./dist/dashback"]
