From 3fd8e0a5a9d0a96bf638e8e2ec6467af92326517 Mon Sep 17 00:00:00 2001 From: luo jiyin Date: Thu, 22 Aug 2024 20:50:03 +0800 Subject: [PATCH] build: reduce docker images size (#87) --- Dockerfile.example | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile.example b/Dockerfile.example index 3aa19ae24..1f21d11cd 100644 --- a/Dockerfile.example +++ b/Dockerfile.example @@ -1,13 +1,13 @@ -FROM node:18-alpine - -ENV NODE_ENV=production - +FROM node:18-slim as builder +WORKDIR /app RUN npm install -g dashpress +FROM node:18-slim +ENV NODE_ENV=production +COPY --from=builder /usr/local/lib/node_modules /usr/local/lib/node_modules +COPY --from=builder /usr/local/bin /usr/local/bin WORKDIR /app - EXPOSE 3000 - CMD ["dashpress"] # Steps to use