Dockerfile

This commit is contained in:
titver968
2025-04-10 16:00:44 +02:00
parent aa598e7943
commit 9b02c40c3f

View File

@@ -1,9 +1,5 @@
# --- Build stage --- # Verwende ein offizielles Node.js-Image als Basis-Image
FROM node:22-bullseye AS build FROM node:22
ENV NODE_ENV=production
ENV ORIGIN=https://tatort.innovation-hub-niedersachsen.de
ENV PNPM_HOME="/usr/local/lib/node_modules/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
# Setze den Arbeitsverzeichnis im Container # Setze den Arbeitsverzeichnis im Container
WORKDIR /usr/src/app WORKDIR /usr/src/app
@@ -18,19 +14,13 @@ COPY package.json pnpm-lock.yaml ./
RUN pnpm install RUN pnpm install
# Kopiere den Rest der Anwendung in das Arbeitsverzeichnis # Kopiere den Rest der Anwendung in das Arbeitsverzeichnis
COPY . ./ COPY . .
RUN pnpm run build # Setze die Umgebungsvariable, um pnpm zu verwenden
ENV PNPM_HOME="/usr/local/lib/node_modules/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
# --- Production stage --- # Exponiere den Port, auf dem die Anwendung läuft
FROM node:22-bullseye AS production
WORKDIR /usr/src/app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --production
COPY --from=build /usr/src/appi/dist ./dist
ENV HOST=0.0.0.0
EXPOSE 3000 EXPOSE 3000
CMD ["sh", "-c", "ORIGIN=https://tatort.innovation-hub-niedersachsen.de node build/index.js"] CMD ["sh", "-c", "ORIGIN=https://tatort.innovation-hub-niedersachsen.de node build/index.js"]