Static files won't load for React apps in production

I’m trying to host a little React app I made with npx create-react-app on [AWS EC2]/ECS.

Now, it functions flawlessly when run from a Docker container locally, but when I deploy the exact same Docker container to ECS, it appears to be failing to serve the static files. I can see that it loads index.html, however it throws this issue when it tries to load the java and css files:

503 Service Temporarily Unavailable

My Dockerfile looks like this:

FROM node:19.2.0

ADD package-lock.json package.json /tmp/
RUN npm ci
RUN npm install -g serve

RUN mkdir -p /usr/src/app && cd /usr/src/app && ln -s /tmp/node_modules

COPY . /usr/src/app
WORKDIR /usr/src/app

RUN npm run build


CMD ["serve", "-s", "build", "-l", "3000"]

I played around with package.json’s homepage setting. Right now, it is set to. however, it doesn’t appear to have any impact.

My application may be found at This will cause index.html to load. contains the js file that isn’t loaded.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.