2023-12-29T14:13:11Z app[568330ddf52d78] iad [info]SyntaxError: Export named 'renderToPipeableStream' not found in module '/app/node_modules/react-dom/server.browser.js'.
Which is not present when building and running on mac, but within the docker container.
To get it working, the final dockerfile looks like:
# syntax = docker/dockerfile:1
# Adjust BUN_VERSION as desired
ARG BUN_VERSION=1.0.15
FROM oven/bun:${BUN_VERSION}-slim as base
LABEL fly_launch_runtime="Remix"
# Remix app lives here
WORKDIR /app
# Set production environment
ENV NODE_ENV="production"
# Throw-away build stage to reduce size of final image
FROM base as build
# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3
# Install node modules
COPY --link bun.lockb package-lock.json package.json ./
RUN bun install
# Update nodejs version
ARG NODE_MAJOR=21
RUN apt-get install -y ca-certificates curl gnupg
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update
RUN apt-get install nodejs -y
# Copy application code
COPY --link . .
# Build application
RUN bun run build
# Remove development dependencies
RUN rm -rf node_modules && \
bun install --ci
# Final stage for app image
FROM base
# Update nodejs version
ARG NODE_MAJOR=21
RUN apt update
RUN apt-get install -y ca-certificates curl gnupg
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update
RUN apt-get install nodejs -y
# Copy built application
COPY --from=build /app /app
# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "bun", "run", "start" ]