-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
99 lines (80 loc) · 2.81 KB
/
Containerfile
File metadata and controls
99 lines (80 loc) · 2.81 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
ARG NODE_VERSION=22-alpine
# Stage 1: Install dependencies and build
FROM node:${NODE_VERSION} AS builder
ARG APP_VERSION
ENV VITE_APP_VERSION=${APP_VERSION}
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /src
# Workspace manifests first for cached installs.
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./
COPY apps/console/package.json apps/console/
COPY packages/ui/package.json packages/ui/
COPY packages/types/package.json packages/types/
COPY packages/k8s-client/package.json packages/k8s-client/
RUN pnpm install --frozen-lockfile
COPY apps/console/ apps/console/
COPY packages/ packages/
COPY tsconfig.base.json ./
RUN pnpm --filter @cozystack/console build
# Stage 2: Serve with nginx
FROM nginxinc/nginx-unprivileged:1.29-alpine
COPY --from=builder /src/apps/console/dist /usr/share/nginx/html
COPY <<'EOF' /etc/nginx/conf.d/default.conf
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 8080 default_server;
listen [::]:8080 default_server;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Kubernetes API proxy for both core and aggregated groups.
# Chunked-encoding watches require proxy_buffering off and a long timeout.
location /apis {
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host kubernetes.default.svc;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
proxy_pass https://kubernetes.default.svc:443;
}
location /api {
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host kubernetes.default.svc;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
proxy_pass https://kubernetes.default.svc:443;
}
# /k8s prefix for VNC WebSocket compatibility
location /k8s/ {
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host kubernetes.default.svc;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
rewrite /k8s/(.*) /$1 break;
proxy_pass https://kubernetes.default.svc:443;
}
# SPA fallback: serve index.html for all frontend routes.
location / {
try_files $uri $uri/ /index.html;
}
location /healthcheck {
access_log off;
return 200 "Healthy\n";
}
}
EOF
EXPOSE 8080