mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
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
This commit is contained in:
@@ -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;"]
|
||||
|
||||
Reference in New Issue
Block a user