FROM node:18-alpine as build WORKDIR /app # Copy package files COPY frontend/package*.json ./ RUN npm install # Copy frontend source code COPY frontend/ . # Build the app RUN npm run build FROM nginx:alpine # Remove default nginx config RUN rm /etc/nginx/conf.d/default.conf # Copy built files COPY --from=build /app/dist /usr/share/nginx/html # Copy nginx configuration COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf COPY docker/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf # Create required directories RUN mkdir -p /var/cache/nginx \ /var/cache/nginx/client_temp \ /var/cache/nginx/proxy_temp \ /var/cache/nginx/fastcgi_temp \ /var/cache/nginx/uwsgi_temp \ /var/cache/nginx/scgi_temp \ /var/run \ /etc/letsencrypt \ /var/www/html EXPOSE 80 443 CMD ["nginx", "-g", "daemon off;"]