File size: 846 Bytes
96ac1a0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
FROM python:3.9-slim-bullseye AS base
WORKDIR /app
FROM base AS build
COPY ["requirements.txt", "./"]
RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
git \
g++ && \
rm -rf /var/lib/apt/lists/* && \
# Install dependencies.
python -m venv ./venv && \
./venv/bin/pip install --upgrade \
pip \
setuptools \
wheel && \
./venv/bin/pip install --no-cache-dir -r ./requirements.txt && \
./venv/bin/pip install --no-cache-dir 'git+https://github.com/facebookresearch/detectron2.git@d1e04565d3bec8719335b88be9e9b961bf3ec464'
FROM base AS final
RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
tesseract-ocr && \
rm -rf /var/lib/apt/lists/*
COPY --from=build ["/app/venv", "./venv"]
# Copy the source code in last to optimize rebuilding the image.
COPY [".", "./"] |