stock / Dockerfile
Zelyanoth's picture
Update Dockerfile
668a758 verified
# 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;"]