React Application to have a staging environment and deploying with Docker on AWS Elastic BeanStalk

I am working on a react application created by create-react-app. I have two environments on AWS Elastic BeanStalk, staging and production. I am deploying my application through Docker. I am using CircleCI for automated deployments.

My problem is I want to change the endpoint url while building the react application.

I am using cross-env for setting a variable REACT_APP_API_HOST but i have to run a command build:staging for building it.

I am not sure how to do it with this docker.

Docker file

FROM node:12

COPY . /app

RUN npm install
RUN npm run build

RUN npm install -g serve


ENTRYPOINT ["serve", "-l", "3000", "-s", "build", "-d"]

And the scripts part of package.json file

"scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject",
        "build:staging": "cross-env REACT_APP_API_HOST=staging react-scripts build",
        "build:prod": "cross-env REACT_APP_API_HOST=production react-scripts build"

Source: StackOverflow