Notes/_regroup_monorepo/apps/server/Dockerfile.alpine
2025-05-02 19:56:19 +00:00

25 lines
735 B
Docker

# Build stage
FROM node:22.15.0-alpine AS builder
WORKDIR /usr/src/app/build
# Copy only necessary files for build
COPY . .
# Build and cleanup in a single layer
RUN npm ci && \
npm run build:prepare-dist && \
npm cache clean --force && \
rm -rf build/node_modules && \
mv build/* \
start-docker.sh \
/usr/src/app/ && \
rm -rf \
/usr/src/app/build \
/tmp/node-compile-cache
#TODO: improve node_modules handling in copy-dist/Dockerfile -> remove duplicated work
# currently copy-dist will copy certain node_module folders, but in the Dockerfile we delete them again (to keep image size down),
# as we install necessary dependencies in runtime buildstage anyways
# Runtime stage