File size: 2,089 Bytes
9e45e7c
 
 
c2397c6
1422e19
c2397c6
b742932
 
 
1c5f8fc
 
b742932
 
 
 
fa4323e
 
1c5f8fc
b742932
 
 
9e45e7c
7170312
9e45e7c
 
1422e19
9e45e7c
1422e19
 
9e45e7c
 
1422e19
db34a2a
b0fe0eb
1422e19
 
 
c2397c6
9e45e7c
 
 
 
1422e19
c2397c6
9e45e7c
 
 
 
 
c2397c6
9e45e7c
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
ARG TORCH_VERSION=2.3.0
ARG CUDA_VERSION=12.1
FROM pytorch/pytorch:${TORCH_VERSION}-cuda${CUDA_VERSION}-cudnn8-runtime

WORKDIR /opt/NekoImageGallery

RUN mkdir -p /opt/NekoImageGallery
RUN chmod 777 /opt/NekoImageGallery

RUN mkdir -p /opt/cache/huggingface
RUN chmod 777 /opt/cache/huggingface

RUN mkdir -p /opt/NekoImageGallery/static
RUN chmod 777 /opt/NekoImageGallery/static

RUN mkdir -p /opt/NekoImageGallery/static/thumbnails
RUN chmod 777 /opt/NekoImageGallery/static/thumbnails

RUN mkdir -p /opt/NekoImageGallery/static/_deleted
RUN chmod 777 /opt/NekoImageGallery/static/_deleted

COPY requirements.txt .

RUN PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir -r requirements.txt

RUN mkdir -p /opt/models && \
    export PYTHONDONTWRITEBYTECODE=1 && \
    huggingface-cli download openai/clip-vit-large-patch14 'model.safetensors' '*.txt' '*.json' --local-dir /opt/models/clip && \
    huggingface-cli download google-bert/bert-base-chinese 'model.safetensors' '*.txt' '*.json' --local-dir /opt/models/bert && \
    huggingface-cli download pk5ls20/PaddleModel 'PaddleOCR2Pytorch/ch_ptocr_v4_det_infer.pth' 'PaddleOCR2Pytorch/ch_ptocr_v4_rec_infer.pth' \
     'PaddleOCR2Pytorch/ch_ptocr_mobile_v2.0_cls_infer.pth' 'PaddleOCR2Pytorch/configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_student.yml' \
     'PaddleOCR2Pytorch/configs/rec/PP-OCRv4/ch_PP-OCRv4_rec.yml' 'ppocr_keys_v1.txt' --local-dir /opt/models/ocr && \
    rm -rf /root/.cache/huggingface

ENV APP_MODEL__CLIP=/opt/models/clip
ENV APP_MODEL__BERT=/opt/models/bert
ENV APP_MODEL__EASYPADDLEOCR=/opt/models/ocr

COPY . .

EXPOSE 8000

VOLUME ["/opt/NekoImageGallery/static"]

LABEL org.opencontainers.image.authors="EdgeNeko" \
      org.opencontainers.image.url="https://github.com/hv0905/NekoImageGallery" \
      org.opencontainers.image.source="https://github.com/hv0905/NekoImageGallery" \
      org.opencontainers.image.title="NekoImageGallery" \
      org.opencontainers.image.description="An AI-powered natural language & reverse Image Search Engine powered by CLIP & qdrant."

ENTRYPOINT ["python", "main.py"]