Created
August 2, 2025 20:21
-
-
Save kannanhassouna/6908f9d03b9e24add9f476b3f6cc92cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # The base image will be used by additional layers | |
| # Only add tools, libraries, etc that will be | |
| # useful in all of the images. | |
| # This is the base layer for the Production Image | |
| ARG hit_master_registry="066561413325.dkr.ecr.us-east-2.amazonaws.com" | |
| FROM ubuntu:22.04 AS baseimage | |
| # Install the packages we'll need in all images | |
| RUN DEBIAN_FRONTEND=noninteractive \ | |
| apt-get update && \ | |
| apt-get dist-upgrade -y && \ | |
| apt-get autoremove -y && \ | |
| apt-get install --no-install-recommends -y \ | |
| python3-pip \ | |
| python3.10-venv | |
| WORKDIR /app | |
| COPY src/ /app/src/ | |
| # The builder image contains additional tools we'll need for building requirements. | |
| # This image will be thrown away after we copy needed build artifacts out. | |
| FROM baseimage AS builder | |
| COPY requirements.txt /app/ | |
| RUN /usr/bin/python3 -m venv --copies /opt/venv && \ | |
| /opt/venv/bin/pip3 install setuptools wheel && \ | |
| /opt/venv/bin/pip3 install --no-cache -r requirements.txt | |
| # Add CA Certs to Certifi CA Store | |
| COPY .build/certificates/HIT-CA-Chain.pem /tmp/ | |
| RUN cat /tmp/HIT-CA-Chain.pem >> \ | |
| $(/opt/venv/bin/pip3 show certifi | awk '/Location/ {print $2}')/certifi/cacert.pem | |
| # Start with the Production Image | |
| # This has the baseline tools we need, the source code, | |
| # and copies in the venv with the prod modules | |
| FROM baseimage AS prodimage | |
| COPY --from=builder /opt/venv /opt/venv/ | |
| # Set the environment variable | |
| ENV EASYOCR_MODULE_PATH=/tmp/.EasyOCR | |
| ENV HF_HOME=/tmp/docling_cache/huggingface | |
| ENV UV_CACHE_DIR=/tmp/docling_cache/uv | |
| ENV DOCLING_SERVE_ARTIFACTS_PATH=/tmp/docling_cache/docling | |
| # Create a folder (if it doesn't already exist) and set permissions | |
| RUN mkdir -p /nonexistent && chmod 777 /nonexistent | |
| RUN mkdir -p /nonexistent/.EasyOCR && chmod 777 /nonexistent/.EasyOCR | |
| RUN apt-get update && apt-get install -y --no-install-recommends libicu-dev | |
| RUN apt install ttf-mscorefonts-installer -y | |
| RUN apt-get update && apt-get install -y \ | |
| libfontconfig1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY .build/startup.sh /app/ | |
| ENTRYPOINT ["/app/.build/startup.sh"] | |
| # Default to running the API, change to "streamlit" to run frontend | |
| CMD [""] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment