# Stage 1: Build the Astro app FROM node:18-alpine AS build WORKDIR /usr/src/app # Install dependencies COPY package*.json ./ RUN npm install # Copy the rest of the app COPY . . # Build the Astro app RUN npm run build # Stage 2: Serve the app using nginx FROM nginx:alpine # Copy built files to nginx's html directory COPY --from=build /usr/src/app/dist /usr/share/nginx/html # Expose port 80 EXPOSE 80 # Start nginx CMD ["nginx", "-g", "daemon off;"]