2024-01-13 05:00:09 +00:00
|
|
|
FROM python:3.11-bookworm@sha256:497c00ec2cff14316a6859c4e30fc88e7ab1f11dd254fb43b8f4b201ca657596 as builder
|
2023-06-16 15:28:41 +00:00
|
|
|
|
2023-03-03 22:45:20 +00:00
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
2023-04-26 10:39:24 +00:00
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
PIP_NO_CACHE_DIR=true
|
2023-03-01 15:37:12 +00:00
|
|
|
|
2023-06-05 14:40:48 +00:00
|
|
|
RUN pip install --upgrade pip && pip install poetry
|
|
|
|
RUN poetry config installer.max-workers 10 && \
|
|
|
|
poetry config virtualenvs.create false
|
2023-03-01 17:48:35 +00:00
|
|
|
RUN python -m venv /opt/venv
|
2023-06-05 14:40:48 +00:00
|
|
|
ENV VIRTUAL_ENV="/opt/venv" PATH="/opt/venv/bin:${PATH}"
|
2023-03-03 22:45:20 +00:00
|
|
|
|
2023-10-31 10:02:04 +00:00
|
|
|
COPY poetry.lock pyproject.toml ./
|
2023-06-05 14:40:48 +00:00
|
|
|
RUN poetry install --sync --no-interaction --no-ansi --no-root --only main
|
2023-03-01 17:48:35 +00:00
|
|
|
|
2023-06-16 15:28:41 +00:00
|
|
|
|
2024-01-11 17:26:46 +00:00
|
|
|
ARG TARGETPLATFORM
|
|
|
|
ENV ARMNN_PATH=/opt/armnn
|
|
|
|
COPY ann /opt/ann
|
|
|
|
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
|
|
|
|
mkdir /opt/armnn && \
|
|
|
|
curl -SL "https://github.com/ARM-software/armnn/releases/download/v23.11/ArmNN-linux-aarch64.tar.gz" | tar -zx -C /opt/armnn && \
|
|
|
|
cd /opt/ann && \
|
|
|
|
sh build.sh; \
|
|
|
|
else \
|
|
|
|
mkdir /opt/armnn; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2024-01-13 05:00:09 +00:00
|
|
|
FROM python:3.11-slim-bookworm@sha256:637774748f62b832dc11e7b286e48cd716727ed04b45a0322776c01bc526afc3
|
2024-01-11 17:26:46 +00:00
|
|
|
ARG TARGETPLATFORM
|
2023-08-31 23:30:53 +00:00
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends tini libmimalloc2.0 && rm -rf /var/lib/apt/lists/*
|
2023-07-21 14:20:04 +00:00
|
|
|
|
2024-01-11 17:26:46 +00:00
|
|
|
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
|
|
|
|
apt-get update && apt-get install -y --no-install-recommends ocl-icd-libopencl1 mesa-opencl-icd && \
|
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
mkdir --parents /etc/OpenCL/vendors && \
|
|
|
|
echo "/usr/lib/libmali.so" > /etc/OpenCL/vendors/mali.icd && \
|
|
|
|
mkdir /opt/armnn; \
|
|
|
|
fi
|
|
|
|
|
2023-06-05 14:40:48 +00:00
|
|
|
WORKDIR /usr/src/app
|
|
|
|
ENV NODE_ENV=production \
|
|
|
|
TRANSFORMERS_CACHE=/cache \
|
2023-04-26 10:39:24 +00:00
|
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
2023-06-05 14:40:48 +00:00
|
|
|
PATH="/opt/venv/bin:$PATH" \
|
2024-01-11 17:26:46 +00:00
|
|
|
PYTHONPATH=/usr/src \
|
|
|
|
LD_LIBRARY_PATH=/opt/armnn
|
2023-03-01 17:48:35 +00:00
|
|
|
|
2023-12-17 02:30:29 +00:00
|
|
|
# prevent core dumps
|
|
|
|
RUN echo "hard core 0" >> /etc/security/limits.conf && \
|
|
|
|
echo "fs.suid_dumpable 0" >> /etc/sysctl.conf && \
|
|
|
|
echo 'ulimit -S -c 0 > /dev/null 2>&1' >> /etc/profile
|
|
|
|
|
2023-06-05 14:40:48 +00:00
|
|
|
COPY --from=builder /opt/venv /opt/venv
|
2024-01-11 17:26:46 +00:00
|
|
|
COPY --from=builder /opt/armnn/libarmnn.so.?? /opt/armnn/libarmnnOnnxParser.so.?? /opt/armnn/libarmnnDeserializer.so.?? /opt/armnn/libarmnnTfLiteParser.so.?? /opt/armnn/libprotobuf.so.?.??.?.? /opt/ann/libann.s[o] /opt/ann/build.sh /opt/armnn
|
|
|
|
COPY ann/ann.py /usr/src/ann/ann.py
|
2023-08-31 23:30:53 +00:00
|
|
|
COPY start.sh log_conf.json ./
|
2023-06-05 14:40:48 +00:00
|
|
|
COPY app .
|
2024-01-11 17:26:46 +00:00
|
|
|
|
2023-07-21 14:20:04 +00:00
|
|
|
ENTRYPOINT ["tini", "--"]
|
2023-08-31 23:30:53 +00:00
|
|
|
CMD ["./start.sh"]
|