fix(backend): fix Dockerfile builder stage copy by copying /build to /tmp/build first

This commit is contained in:
Plena Finance Dev
2026-07-09 17:03:45 +05:30
parent 461f936b43
commit 78761458c8

View File

@@ -32,10 +32,14 @@ COPY backend/src ./src
# Create public assets directories # Create public assets directories
RUN mkdir -p public public/mobile public/games RUN mkdir -p public public/mobile public/games
# Conditionally copy build assets from the builder stage if they exist # Copy all build context to a temp folder in production stage to run conditional copies
RUN if [ -d "/build/website/dist" ]; then cp -r /build/website/dist/* ./public/; fi COPY --from=builder /build /tmp/build
RUN if [ -d "/build/mobile/dist" ]; then cp -r /build/mobile/dist/* ./public/mobile/; fi
RUN if [ -d "/build/games/dist" ]; then cp -r /build/games/dist/* ./public/games/; fi RUN if [ -d "/tmp/build/website/dist" ]; then cp -r /tmp/build/website/dist/* ./public/; fi
RUN if [ -d "/tmp/build/mobile/dist" ]; then cp -r /tmp/build/mobile/dist/* ./public/mobile/; fi
RUN if [ -d "/tmp/build/games/dist" ]; then cp -r /tmp/build/games/dist/* ./public/games/; fi
RUN rm -rf /tmp/build
ENV NODE_ENV=production ENV NODE_ENV=production
ENV PORT=8080 ENV PORT=8080