# Build stage FROM node:20-alpine as build WORKDIR /app COPY package.json ./ RUN npm install COPY . . RUN npm run build # Production stage FROM nginx:alpine # Copy built assets COPY --from=build /app/dist /usr/share/nginx/html # Nginx config for SPA RUN echo 'server { \ listen 80; \ root /usr/share/nginx/html; \ index index.html; \ location / { \ try_files $uri $uri/ /index.html; \ } \ location /api { \ proxy_pass https://api.crm.kronos-soulution.de; \ proxy_http_version 1.1; \ proxy_set_header Host api.crm.kronos-soulution.de; \ proxy_set_header X-Real-IP $remote_addr; \ proxy_ssl_server_name on; \ } \ }' > /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]