From 020c7030d2a7fe46308ceebd065e0215b1343c59 Mon Sep 17 00:00:00 2001 From: WJG Date: Sun, 2 Jun 2024 10:58:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=20docker=20?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E6=9E=84=E5=BB=BA=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index afefa3d..c8e0a2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,31 +1,29 @@ -# syntax=docker/dockerfile:1 - -# base -FROM node:18-alpine as base +FROM node:20.14.0-alpine as env-amd64 +FROM node:20.14.0-alpine as env-arm64 +FROM arm32v7/node:20.14.0 as env-arm +ENV PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING=1 +ENV PRISMA_QUERY_ENGINE_BINARY=/app/prisma/engines/query-engine +ENV PRISMA_QUERY_ENGINE_LIBRARY=/app/prisma/engines/libquery_engine.so.node +ENV PRISMA_SCHEMA_ENGINE_BINARY=/app/prisma/engines/schema-engine +FROM env-$TARGETARCH as base WORKDIR /app +ARG TARGETARCH -# build FROM base as build - +COPY . . +RUN [ ! "$TARGETARCH" = "arm" ] && rm -rf ./prisma/engines || true RUN --mount=type=cache,target=/root/.npm \ npm install -g pnpm@9.1.1 - -COPY . . - RUN --mount=type=cache,target=/root/.local/share/pnpm/store \ pnpm install && pnpm build -# run -FROM base +FROM base as release +COPY app.js . COPY package.json . COPY --from=build /app/dist ./dist -COPY --from=build /app/scripts ./scripts COPY --from=build /app/prisma ./prisma COPY --from=build /app/node_modules ./node_modules -RUN rm -rf ./prisma/engines - -# Run the application. CMD npm run start