# Dockerfile for Astro webapp # Use official Node.js image as the base FROM node:20-alpine as build # Set working directory WORKDIR /app # Copy package files and install dependencies COPY package.json package-lock.json ./ RUN npm ci # Copy the rest of the application code COPY . . # Build the Astro project RUN npm run build # Production image FROM node:20-alpine as prod WORKDIR /app # Install only production dependencies COPY package.json package-lock.json ./ RUN npm ci --omit=dev # Copy built files from build stage COPY --from=build /app/dist ./dist COPY public ./public # Expose Astro's default port EXPOSE 4321 # Start the Astro preview server CMD ["npx", "astro", "preview"]