Spaces:
Sleeping

File size: 1,775 Bytes
1a49047
 
 
 
 
 
 
 
 
 
8a62125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6590d03
 
 
8a62125
 
81e12ec
 
8a62125
 
 
 
 
 
 
 
1a49047
 
8a62125
81e12ec
 
8a62125
 
 
 
6590d03
 
 
8a62125
 
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM node:22-slim AS assets

WORKDIR /ui
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
# Emits hashed bundle + manifest into ../src/... per vite.config outDir; we
# redirect it into a local dist and copy it explicitly below.
RUN npm run build -- --outDir dist --emptyOutDir

FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS builder

ENV UV_COMPILE_BYTECODE=1 \
    UV_LINK_MODE=copy \
    UV_PYTHON_DOWNLOADS=never

WORKDIR /app

COPY pyproject.toml uv.lock README.md ./
RUN --mount=type=cache,target=/root/.cache/uv \
    uv sync --frozen --no-install-project --no-dev

COPY src ./src
RUN --mount=type=cache,target=/root/.cache/uv \
    uv sync --frozen --no-dev

FROM python:3.13-slim AS runtime

ARG JELLYSCOPE_VERSION=dev
LABEL org.opencontainers.image.version="${JELLYSCOPE_VERSION}"

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PATH="/app/.venv/bin:$PATH" \
    HF_HOME=/home/jellyscope/.cache/huggingface

RUN groupadd --system --gid 1000 jellyscope \
    && useradd --system --uid 1000 --gid jellyscope --create-home --shell /usr/sbin/nologin jellyscope

WORKDIR /app

COPY --from=builder --chown=jellyscope:jellyscope /app/.venv /app/.venv
COPY --from=builder --chown=jellyscope:jellyscope /app/src /app/src
# Built frontend bundle from the Node stage.
COPY --from=assets --chown=jellyscope:jellyscope /ui/dist /app/src/jellyscope/web/static/dist

RUN mkdir -p /data && chown -R jellyscope:jellyscope /data

USER jellyscope

EXPOSE 5000

HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
    CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:5000/').read()"

ENTRYPOINT ["jellyscope"]
CMD ["--host", "0.0.0.0", "--port", "5000", "--data-dir", "/data"]