I am running a simple React app in Docker which runs fine. When I check the logs of the pods it returns a message
2024-08-16 15:58:34 Note that the development build is not optimized.
2024-08-16 15:58:34 To create a production build, use npm run build.
I updated the Dockerfile and included RUN npm run build:${BUILD_ENV}
but the warning still returns. I have the Dockerfile below.
# set the base image to build from
FROM node:20-alpine AS builder
ARG BUILD_ENV
#SET ENV
ENV BUILD_ENV $BUILD_ENV
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# copy package files
COPY package.json ./
COPY package-lock.json ./
RUN npm ci --only=production
COPY . /usr/src/app/
COPY .env.staging /usr/src/app/.env
RUN npm run build:${BUILD_ENV}
EXPOSE 3000
# run the app
CMD ["sh", "-c", "npm run start:${BUILD_ENV}"]
What am I doing wrong?
1