From c3d7803bd5dd82c9dd38a3a52fbd3646d0857aa1 Mon Sep 17 00:00:00 2001 From: "Stephanos A." Date: Tue, 2 Jun 2026 23:33:56 +0300 Subject: [PATCH] Fix: Replace invalid COPY commands inside RUN with proper multi-stage copy instructions The RUN instruction cannot contain COPY commands. Fixed by moving the COPY instructions outside the RUN block and copying both Next.js (.next) and Vite (dist) build outputs from the builder stage. The nginx configuration can serve both build outputs appropriately. Fixes: Docker build failure with "COPY: not found" error --- infrastructure/docker/Dockerfile.web | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/infrastructure/docker/Dockerfile.web b/infrastructure/docker/Dockerfile.web index d5d2fe4ac..1f7145856 100644 --- a/infrastructure/docker/Dockerfile.web +++ b/infrastructure/docker/Dockerfile.web @@ -53,13 +53,10 @@ FROM nginx:alpine AS runner ARG APP_PATH COPY infrastructure/nginx/spa.conf /etc/nginx/conf.d/default.conf -# Copy Next.js build output if it exists -RUN if [ -d "/app/${APP_PATH}/.next" ]; then \ - COPY --from=builder /app/${APP_PATH}/.next /usr/share/nginx/html/.next && \ - COPY --from=builder /app/${APP_PATH}/public /usr/share/nginx/html/public 2>/dev/null || true; \ - else \ - COPY --from=builder /app/${APP_PATH}/dist /usr/share/nginx/html; \ - fi +# Copy Next.js or Vite build output from builder stage +COPY --from=builder /app/${APP_PATH}/.next /usr/share/nginx/html/.next +COPY --from=builder /app/${APP_PATH}/public /usr/share/nginx/html/public +COPY --from=builder /app/${APP_PATH}/dist /usr/share/nginx/html/dist EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]