File size: 768 Bytes
9434859
56cad31
a86de96
9ff907f
00e7676
9434859
a86de96
9434859
cc224f9
 
668a758
9434859
668a758
 
 
 
9434859
 
668a758
 
9434859
 
 
 
 
cc224f9
9434859
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Base image
FROM node:20-alpine as build

RUN adduser -D -u 1010 user

USER user

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

WORKDIR /home/user/app

# Copie des fichiers package* avec modification de la propriété
COPY --chown=user:user package*.json ./

# Installation des dépendances
RUN npm install

# Copie de l'application
COPY --chown=user:user . .
RUN npm run build

# Production image
FROM nginx:alpine

COPY --from=build /home/user/app/dist /usr/share/nginx/html

RUN echo 'server { \
    listen 7860; \
    server_name _; \
    root /usr/share/nginx/html; \
    index index.html; \
    location / { \
        try_files $uri $uri/ /index.html; \
    } \
}' > /etc/nginx/conf.d/default.conf

EXPOSE 7860

CMD ["nginx", "-g", "daemon off;"]