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