Download Dockerfile from Hanchin/easy-ocr: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/Hanchin/easy-ocr/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Hanchin/easy-ocr/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Hanchin/easy-ocr/resolve/main/Dockerfile
1.07 kB
| # build stage | |
| FROM python:3.9.16 AS builder | |
| # install PDM | |
| RUN pip install -U pip setuptools wheel -i https://pypi.tuna.tsinghua.edu.cn/simple | |
| RUN pip install pdm -i https://pypi.tuna.tsinghua.edu.cn/simple | |
| # copy files | |
| COPY pyproject.toml pdm.lock README.md /project/ | |
| COPY src/ /project/src | |
| ENV PDM_PYPI_URL="https://pypi.tuna.tsinghua.edu.cn/simple" | |
| # install dependencies and project into the local packages directory | |
| WORKDIR /project | |
| RUN --mount=type=cache,target=/root/.cache mkdir __pypackages__ && pdm sync --prod --no-editable | |
| # run stage | |
| FROM python:3.9.16 | |
| # retrieve packages from build stage | |
| ENV PYTHONPATH=/project/pkgs | |
| COPY --from=builder /project/__pypackages__/3.9/lib /project/pkgs | |
| # retrieve executables | |
| COPY --from=builder /project/__pypackages__/3.9/bin/* /bin/ | |
| COPY ./assets /home/appuser/.EasyOCR/model | |
| WORKDIR /home/appuser | |
| RUN useradd -m appuser && chown -R appuser:appuser /home/appuser | |
| USER appuser | |
| # set command/entrypoint, adapt to fit your needs | |
| CMD ["/bin/gunicorn", "-w", "3", "-b", "0.0.0.0:8080", "--timeout", "300", "app:app"] | |