# Base image with CANN for compilation
ARG ASCEND_VERSION=cann:8.0.0-910b-openeuler22.03-py3.10

FROM quay.io/ascend/${ASCEND_VERSION} AS builder
ARG GOLANG_VERSION
COPY . /src/ramalama
WORKDIR /src/ramalama
RUN container-images/scripts/build_llama_and_whisper.sh cann

FROM quay.io/ascend/${ASCEND_VERSION}
# Copy the entire installation directory from the builder
COPY --from=builder /tmp/install /usr
ENTRYPOINT [ \
    "/bin/bash", \
    "-c", \
    "export LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH} && source /usr/local/Ascend/ascend-toolkit/set_env.sh && exec \"$@\"", "--" \
]
