From dd908676e536dc02db7949d63d22d2041e9c837e Mon Sep 17 00:00:00 2001 From: Bernd Storath <999999bst@gmail.com> Date: Mon, 3 Mar 2025 10:45:59 +0100 Subject: [PATCH] optimize dockerfile --- Dockerfile | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index efdda18b..c632785d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,20 +7,14 @@ RUN npm install --global corepack@latest # Install pnpm RUN corepack enable pnpm -# add build tools for argon2 -RUN apk add --no-cache make gcc g++ python3 - # Copy Web UI -COPY src ./ +COPY src/package.json src/pnpm-lock.yaml ./ RUN pnpm install # Build UI +COPY src ./ RUN pnpm build -# Remove unnecessary node modules -RUN find ./node_modules/.pnpm -mindepth 1 -maxdepth 1 -type d ! -name '@libsql+linux*' -exec rm -r {} + -RUN find ./node_modules/@libsql -mindepth 1 -maxdepth 1 -type l ! -name 'linux*' -exec rm -r {} + - # Copy build result to a new image. # This saves a lot of disk space. FROM docker.io/library/node:lts-alpine @@ -33,8 +27,7 @@ COPY --from=build /app/.output /app # Copy migrations COPY --from=build /app/server/database/migrations /app/server/database/migrations # libsql -COPY --from=build /app/node_modules/.pnpm/ /app/node_modules/.pnpm/ -COPY --from=build /app/node_modules/@libsql /app/node_modules/@libsql +RUN npm install --no-save libsql # Install Linux packages RUN apk add --no-cache \