ARG CODEHYGIENE_REF=2ec03172f47f14655c1490540c2f593b77095807 FROM node:22-slim AS web ARG CODEHYGIENE_REF WORKDIR /build COPY web/package.json web/package-lock.json web/ RUN cd web && npm ci COPY web/ web/ COPY presets.json web/vendor/presets.json ADD https://raw.githubusercontent.com/brianbell-x/codehygiene/${CODEHYGIENE_REF}/codehygiene/engine.js web/vendor/engine.js ADD https://raw.githubusercontent.com/brianbell-x/codehygiene/${CODEHYGIENE_REF}/codehygiene/weights.npz web/vendor/weights.npz RUN cd web && npm run build FROM python:3.12-slim ARG CODEHYGIENE_REF RUN apt-get update \ && apt-get install -y --no-install-recommends git \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONUNBUFFERED=1 WORKDIR /home/user/app COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --user \ -r requirements.txt \ "codehygiene @ git+https://github.com/brianbell-x/codehygiene@${CODEHYGIENE_REF}" COPY --chown=user server/ server/ COPY --from=web --chown=user /build/web/dist web/dist COPY --from=web --chown=user /build/web/vendor/presets.json web/vendor/presets.json EXPOSE 7860 CMD ["python", "-m", "uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--no-access-log"]