-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (28 loc) · 1 KB
/
Dockerfile
File metadata and controls
39 lines (28 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -------------------------------------------------
# 1) Build-Stage
# -------------------------------------------------
FROM node:22.16.0-alpine AS builder
# Arbeitsverzeichnis im Container
WORKDIR /app
# Nur package.json und lockfile kopieren, um Layer-Caching zu ermöglichen
COPY package*.json ./
# Abhängigkeiten installieren
RUN npm ci --legacy-peer-deps
# Rest des Quellcodes kopieren
COPY . .
# Angular CLI lokal installieren (falls nicht in devDependencies)
RUN npm install @angular/cli@latest --no-save
# Anwendung bauen
RUN npx ng build --configuration=production
# -------------------------------------------------
# 2) Production-Stage
# -------------------------------------------------
FROM nginx:1.25-alpine AS production
# Entferne standardmäßiges nginx HTML
RUN rm -rf /usr/share/nginx/html/*
# Kopiere die gebauten Dateien aus dem Builder
COPY --from=builder /app/dist/angular-demo-application /usr/share/nginx/html
# Exponiere Port
EXPOSE 80
# Default-Command
CMD ["nginx", "-g", "daemon off;"]