49 lines
1.6 KiB
Docker
49 lines
1.6 KiB
Docker
FROM node:24-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
RUN npm install -g pnpm@10.26.1
|
|
|
|
# 1. Alle Projektdateien in den Container bringen
|
|
COPY . .
|
|
|
|
# 2. Abhängigkeiten installieren
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Zwingt pnpm, alle nativen Binärdateien für Alpine physisch bereit zustellen
|
|
RUN pnpm add -w @rollup/rollup-linux-x64-musl lightningcss-linux-x64-musl @tailwindcss/oxide-linux-x64-musl --save-optional --config.ignore-scripts=false
|
|
|
|
ENV BASE_PATH=/
|
|
ENV PORT=8080
|
|
|
|
RUN pnpm -r --if-present run build
|
|
|
|
FROM node:24-alpine AS runner
|
|
WORKDIR /app
|
|
|
|
RUN npm install -g pnpm@10.26.1
|
|
|
|
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
|
COPY lib/db/package.json lib/db/
|
|
COPY lib/api-spec/package.json lib/api-spec/
|
|
COPY lib/api-zod/package.json lib/api-zod/
|
|
COPY lib/api-client-react/package.json lib/api-client-react/
|
|
COPY artifacts/api-server/package.json artifacts/api-server/
|
|
COPY artifacts/toolrate/package.json artifacts/toolrate/
|
|
|
|
RUN pnpm install --frozen-lockfile --prod
|
|
|
|
# Auch für den Runner-Stage stellen wir sicher, dass alle drei Pakete im Produktiv-Image existieren
|
|
RUN pnpm add -w @rollup/rollup-linux-x64-musl lightningcss-linux-x64-musl @tailwindcss/oxide-linux-x64-musl --save-optional --prod
|
|
|
|
# HIER DER FIX: Kopiert den gesamten Ordner lib/db (inkl. src/), da es kein dist/ gibt
|
|
COPY --from=builder /app/lib/db lib/db
|
|
COPY --from=builder /app/artifacts/api-server/dist artifacts/api-server/dist
|
|
COPY --from=builder /app/artifacts/toolrate/dist artifacts/toolrate/dist
|
|
|
|
ENV NODE_ENV=production
|
|
ENV STATIC_DIR=/app/artifacts/toolrate/dist/public
|
|
|
|
EXPOSE 8080
|
|
|
|
CMD ["node", "--enable-source-maps", "artifacts/api-server/dist/index.mjs"]
|