Home > Software engineering >  Docker / React - not working with script for environmental variables
Docker / React - not working with script for environmental variables

Time:03-18

I am trying to use environmental variables in my Docker / React project, using this article: https://www.freecodecamp.org/news/how-to-implement-runtime-environment-variables-with-create-react-app-docker-and-nginx-7f9d42a91d70/

I am using npm instead of yarn, what would be the equivalent to this:

FROM node:alpine as builder
WORKDIR /app
COPY package.json .
COPY yarn.lock .
RUN yarn
COPY . .
RUN yarn build

Any idea's? Thanks

CodePudding user response:

Belo Dockerfile can be used for npm:

FROM node:alpine as builder
WORKDIR /app
COPY package.json .
COPY *.lock .
RUN npm install
COPY . .
RUN npm run build
  • Related