From 78761458c862783141098998c339ce86ac4896dc Mon Sep 17 00:00:00 2001 From: Plena Finance Dev Date: Thu, 9 Jul 2026 17:03:45 +0530 Subject: [PATCH] fix(backend): fix Dockerfile builder stage copy by copying /build to /tmp/build first --- backend/Dockerfile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 752df10..259e0c1 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -32,10 +32,14 @@ COPY backend/src ./src # Create public assets directories RUN mkdir -p public public/mobile public/games -# Conditionally copy build assets from the builder stage if they exist -RUN if [ -d "/build/website/dist" ]; then cp -r /build/website/dist/* ./public/; fi -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 +# Copy all build context to a temp folder in production stage to run conditional copies +COPY --from=builder /build /tmp/build + +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 PORT=8080