From 4ee655c0754ff6916965574c17cefe15cc1c256c Mon Sep 17 00:00:00 2001 From: Xiaodong Ye Date: Thu, 25 Jan 2024 18:08:35 +0800 Subject: [PATCH] Reduce container image size Signed-off-by: Xiaodong Ye --- Dockerfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4a23e914..a3c03328 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,9 +5,10 @@ FROM node:alpine as build WORKDIR /app # wget embedding model weight from alpine (does not exist from slim-buster) -RUN wget "https://chroma-onnx-models.s3.amazonaws.com/all-MiniLM-L6-v2/onnx.tar.gz" +RUN wget "https://chroma-onnx-models.s3.amazonaws.com/all-MiniLM-L6-v2/onnx.tar.gz" -O - | \ + tar -xzf - -C /app -COPY package.json package-lock.json ./ +COPY package.json package-lock.json ./ RUN npm ci COPY . . @@ -44,10 +45,7 @@ RUN apt-get update \ # copy embedding weight from build RUN mkdir -p /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2 -COPY --from=build /app/onnx.tar.gz /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2 - -RUN cd /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2 &&\ - tar -xzf onnx.tar.gz +COPY --from=build /app/onnx /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2/onnx # copy built frontend files COPY --from=build /app/build /app/build @@ -55,4 +53,4 @@ COPY --from=build /app/build /app/build # copy backend files COPY ./backend . -CMD [ "sh", "start.sh"] \ No newline at end of file +CMD [ "sh", "start.sh" ] \ No newline at end of file