Production Docker container hosting React shuts down

My dockerized react app is ready for deployment but shuts down after 10 or so seconds in the production environment. I have restart: unless-stopped in the file which makes it restart every 10 or so seconds.

I have tried adding std_in: true and tty: true to the file, as suggested, to no avail.

Docker Compose:

      context: ./frontend
    stdin_open: true
    image: "${FRONTEND_IMAGE}"
    restart: unless-stopped
      - frontend_build:/frontend/build
      - backend
    env_file: .env

FROM node:16.13.0

# Create and set the working directory on the container
# then copy over the package.json and package-lock.json
WORKDIR /frontend
COPY package*.json ./

# Install the node packages before copying the files
RUN npm install
COPY . .

# Run the production build
CMD ["npm", "run", "build"]

docker logs [frontend_container]:

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
You may serve it with a static server:

  npm install -g serve
  serve -s build

Find out more about deployment here:

> frontend@0.1.0 build
> react-scripts build

Creating an optimized production build...

Thoughts on how to fix the issue?