|
1 | | -FROM python:3.11 |
| 1 | +FROM debian:12-slim AS build-venv |
2 | 2 |
|
3 | | -WORKDIR /root |
4 | | - |
5 | | -ENV content=/root/comiclib watch=False |
6 | | -EXPOSE 8000 |
7 | | - |
8 | | -RUN apt-get -y update && apt-get -y install ffmpeg |
9 | | - |
10 | | -COPY . /tmp/comiclib |
11 | | - |
12 | | -RUN pip install --no-cache-dir -U "/tmp/comiclib[full]" |
13 | | -RUN pip install --no-cache-dir -U gunicorn |
| 3 | +RUN apt-get update && \ |
| 4 | + apt-get install --no-install-suggests --no-install-recommends --yes xz-utils python3 python3-venv && \ |
| 5 | + apt-get clean && \ |
| 6 | + python3 -m venv /venv && \ |
| 7 | + /venv/bin/pip install --upgrade pip |
14 | 8 |
|
| 9 | +ADD https://files.niconi.org/api_dump.sqlite.7z /tmp |
| 10 | +ADD https://github.com/eugeneware/ffmpeg-static/releases/download/b6.0/ffmpeg-linux-x64 /usr/bin/ffmpeg |
15 | 11 | ADD https://www.7-zip.org/a/7z2301-linux-x64.tar.xz /tmp/ |
16 | | -RUN tar -C /usr/bin/ -xvf /tmp/7z*.tar.xz 7zz |
17 | | - |
18 | | -# Please download through BitTorrent yourself. |
19 | | -RUN 7zz x /tmp/comiclib/e-hentai_*/api_dump.sqlite.7z |
20 | | -RUN rm -r /tmp/* |
21 | | - |
22 | | -RUN python3 -c "from comiclib import frontend_boost" |
23 | | - |
24 | | -VOLUME /root |
25 | | - |
26 | | -CMD [ "gunicorn", "comiclib.main:app", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000", "--preload", "--workers", "4" ] |
| 12 | +RUN tar -C /usr/bin -xvf /tmp/7z*.tar.xz 7zz |
| 13 | +RUN mkdir /exract |
| 14 | +WORKDIR /extract |
| 15 | +RUN 7zz x /tmp/api_dump.sqlite.7z |
| 16 | +COPY . /tmp/comiclib |
| 17 | +RUN /venv/bin/pip install --no-cache-dir -U "/tmp/comiclib[full]" |
| 18 | +RUN /venv/bin/pip install --no-cache-dir -U gunicorn |
| 19 | +RUN mkdir /userdata |
| 20 | +# RUN rm -r /tmp/* |
| 21 | + |
| 22 | +FROM gcr.io/distroless/python3-debian12 |
| 23 | +COPY --from=build-venv /venv /venv |
| 24 | +COPY --from=build-venv /usr/bin/7zz /usr/bin |
| 25 | +COPY --from=build-venv /usr/bin/ffmpeg /usr/bin |
| 26 | +COPY --from=build-venv /extract/api_dump.sqlite /data/api_dump.sqlite |
| 27 | +COPY --from=build-venv /userdata /userdata |
| 28 | +ENV importEHdb_API_DUMP_PATH=/data/api_dump.sqlite content=/root/comiclib watch=False |
| 29 | +EXPOSE 8000 |
| 30 | +WORKDIR /userdata |
| 31 | +VOLUME /userdata |
| 32 | +VOLUME /root/comiclib |
| 33 | +RUN [ "/venv/bin/python", "-c", "from comiclib import frontend_boost" ] |
| 34 | +ENTRYPOINT [ "/venv/bin/python", "-m" , "gunicorn", "comiclib.main:app", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000", "--preload", "--workers", "4" ] |
0 commit comments