| |
| 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 |
|
|
| |
| COPY --chown=user:user package*.json ./ |
|
|
| |
| RUN npm install |
|
|
| |
| COPY --chown=user:user . . |
| RUN npm run build |
|
|
| |
| 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;"] |
|
|