Upload folder using huggingface_hub
Browse files- Dockerfile +12 -4
Dockerfile
CHANGED
|
@@ -1,4 +1,11 @@
|
|
| 1 |
# syntax=docker/dockerfile:1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
FROM python:3.11.17-slim-bookworm
|
| 3 |
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 OMP_NUM_THREADS=2 OPENBLAS_NUM_THREADS=1 \
|
| 4 |
OCR_MODELS_DIR=/opt/ocr-models HOME=/home/ocr
|
|
@@ -7,11 +14,12 @@ ARG OCR_SOURCE_REVISION=unknown
|
|
| 7 |
ENV OCR_SOURCE_REVISION=$OCR_SOURCE_REVISION
|
| 8 |
WORKDIR /app
|
| 9 |
# Build from repository root. Only OCR dependencies and code enter this separate worker.
|
| 10 |
-
COPY
|
| 11 |
RUN --mount=type=secret,id=proxy_ca \
|
| 12 |
if [ -f /run/secrets/proxy_ca ]; then export PIP_CERT=/run/secrets/proxy_ca; fi; \
|
| 13 |
-
pip install --no-cache-dir -
|
| 14 |
-
COPY
|
|
|
|
| 15 |
# Download once at build time, verify pinned SHA256s, keep inference offline.
|
| 16 |
RUN --mount=type=secret,id=proxy_ca \
|
| 17 |
if [ -f /run/secrets/proxy_ca ]; then export SSL_CERT_FILE=/run/secrets/proxy_ca; fi; \
|
|
@@ -20,4 +28,4 @@ RUN useradd --uid 1000 --create-home ocr && chmod -R a+rX /opt/ocr-models /app
|
|
| 20 |
USER ocr
|
| 21 |
EXPOSE 7860
|
| 22 |
HEALTHCHECK --interval=30s --timeout=5s CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:7860/health',timeout=3)"
|
| 23 |
-
CMD ["uvicorn", "
|
|
|
|
| 1 |
# syntax=docker/dockerfile:1
|
| 2 |
+
FROM node:20-bookworm AS frontend
|
| 3 |
+
WORKDIR /app/atk-interface
|
| 4 |
+
COPY atk-interface/package*.json ./
|
| 5 |
+
RUN npm ci
|
| 6 |
+
COPY atk-interface/ .
|
| 7 |
+
RUN npm run build
|
| 8 |
+
|
| 9 |
FROM python:3.11.17-slim-bookworm
|
| 10 |
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 OMP_NUM_THREADS=2 OPENBLAS_NUM_THREADS=1 \
|
| 11 |
OCR_MODELS_DIR=/opt/ocr-models HOME=/home/ocr
|
|
|
|
| 14 |
ENV OCR_SOURCE_REVISION=$OCR_SOURCE_REVISION
|
| 15 |
WORKDIR /app
|
| 16 |
# Build from repository root. Only OCR dependencies and code enter this separate worker.
|
| 17 |
+
COPY requirements.txt /tmp/requirements.txt
|
| 18 |
RUN --mount=type=secret,id=proxy_ca \
|
| 19 |
if [ -f /run/secrets/proxy_ca ]; then export PIP_CERT=/run/secrets/proxy_ca; fi; \
|
| 20 |
+
pip install --no-cache-dir -r /tmp/requirements.txt
|
| 21 |
+
COPY . /app
|
| 22 |
+
COPY --from=frontend /app/atk-interface/dist /app/atk-interface/dist
|
| 23 |
# Download once at build time, verify pinned SHA256s, keep inference offline.
|
| 24 |
RUN --mount=type=secret,id=proxy_ca \
|
| 25 |
if [ -f /run/secrets/proxy_ca ]; then export SSL_CERT_FILE=/run/secrets/proxy_ca; fi; \
|
|
|
|
| 28 |
USER ocr
|
| 29 |
EXPOSE 7860
|
| 30 |
HEALTHCHECK --interval=30s --timeout=5s CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:7860/health',timeout=3)"
|
| 31 |
+
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]
|