FROM node:22-alpine

ENV NEXT_TELEMETRY_DISABLED=1

WORKDIR /app

# Build-time proxy. Compose passes these via build args.
# Active only during `npm install` below; cleared again before runtime.
ARG HTTP_PROXY=
ARG HTTPS_PROXY=
ENV HTTP_PROXY=${HTTP_PROXY} \
    HTTPS_PROXY=${HTTPS_PROXY} \
    http_proxy=${HTTP_PROXY} \
    https_proxy=${HTTPS_PROXY}

COPY .npmrc package.json package-lock.json ./
# `npm install` (not `npm ci`) is forgiving when the lockfile was generated
# against a different registry (e.g. npmjs) than the one in .npmrc.
RUN npm install --no-audit --no-fund

# Drop the proxy from the runtime image — only the install step needed it.
ENV HTTP_PROXY= HTTPS_PROXY= http_proxy= https_proxy=

COPY . .

EXPOSE 3000

CMD ["npm", "run", "dev", "--", "-H", "0.0.0.0"]
