-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.frontend
More file actions
34 lines (22 loc) · 818 Bytes
/
Copy pathDockerfile.frontend
File metadata and controls
34 lines (22 loc) · 818 Bytes
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
FROM node:20-slim AS builder
# usiamo Node.js per compilare il frontend (avendo usato Vue)
WORKDIR /app
# impostiamo la cartella di lavoro
RUN corepack enable
# utilizzato per lo yarn
COPY webui/package.json webui/yarn.lock ./
# copiamo i file delle dipendenze
COPY webui/ .
# copiamo tutto il codice sorgente
RUN yarn install
# installiamo le dipendenze
ENV NODE_OPTIONS="--max-old-space-size=4096"
#aumentiamo la memoria
RUN yarn vite build --mode production
# buildiamo (ps. crea anche la cartella "dist" con i file ottimizzati)
FROM nginx:alpine
# ora, per il server web usiamo nginx che è leggero e servirà per ospitare il frontend
COPY --from=builder /app/dist /usr/share/nginx/html
# copiamo i file compilati del builder nella cartella pubblica di Nginx
EXPOSE 80
CMD ["nginx","-g","daemon off;"]