| FROM node:22-bookworm-slim AS static-assets | |
| ARG ESBUILD_VERSION=0.28.2 | |
| WORKDIR /build | |
| RUN npm install --global "esbuild@${ESBUILD_VERSION}" \ | |
| && test "$(esbuild --version)" = "${ESBUILD_VERSION}" | |
| COPY static/ /build/static/ | |
| RUN cp -a static /out \ | |
| && esbuild static/app.js --minify --target=es2019 --charset=utf8 --legal-comments=none --outfile=/out/app.js \ | |
| && esbuild static/style.css --minify --outfile=/out/style.css \ | |
| && esbuild static/sw.js --minify --target=es2019 --charset=utf8 --legal-comments=none --outfile=/out/sw.js | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY app.py build_fulltext_db.py prepare_fulltext_index.py start.sh ./ | |
| COPY --from=static-assets /out/ static/ | |
| COPY data/ data/ | |
| COPY CCRD/ CCRD/ | |
| COPY CW/ CW/ | |
| EXPOSE 7860 | |
| CMD ["sh", "/app/start.sh"] | |