Spaces:
Sleeping
Sleeping
File size: 1,341 Bytes
5c265c1 161cb23 5c265c1 161cb23 a1415e8 161cb23 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 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"]
|