I have nginx and client images, loaded by docker-compose.yml file. For some reason, the environment variables (REACT_APP_MAXIMUM_CAMERAS_COUNT) are not visible when the application is running (I get undefined), and I can't figure out why.
Here is my create-react-app Dockerfile:
FROM node:alpine as builder
WORKDIR /app
COPY ./package.json ./
RUN npm i
COPY . .
RUN npm run build
FROM nginx
EXPOSE 3000
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/build /usr/share/nginx/html
And here is my docker-compose.yml file:
version: '3'
services:
nginx:
image: <ip_address>:5000/orassayag/osr_streamer_nginx:v1.0
restart: always
ports:
- '3050:80'
client:
image: <ip_address>:5000/orassayag/osr_streamer_client:v1.0
environment:
- REACT_APP_MAXIMUM_CAMERAS_COUNT=10
**Note** that since the docker-compose pulls the images from a private registry (without any build), it can't use the "build" blocks with "args" (already tried with args and it works).
Any workaround to solve this?