FROM node:20.11.1 AS builder WORKDIR /app COPY package.json ./ # --- THE FIX IS HERE --- # 1. Install ALL dependencies (including devDependencies like vue-tsc) RUN npm install # 2. Copy the appropriate .env file for local environment COPY .env.local .env # 3. Copy the rest of your source code COPY . . # 3. Now run the build, which will succeed because vue-tsc is installed RUN npm run build # --- STAGE 2: Serve the built files with Nginx --- FROM nginx:stable-alpine # Copy the static files from the 'builder' stage COPY --from=builder /app/dist /usr/share/nginx/html # Copy your custom Nginx configuration COPY nginx/default.conf /etc/nginx/conf.d/default.conf # Tell the world that port 80 is now listening EXPOSE 80 # Start Nginx when the container launches CMD ["nginx", "-g", "daemon off;"]