I have an angular application and it was required to me to put it in a docker image. My first version of the Dockerfile is as next:
### STAGE 1: Build ###
# We label our stage as 'builder'
FROM node:8-alpine as builder
COPY package.json package-lock.json ./
RUN npm set progress=false && npm config set depth 0 && npm cache clean --force
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm i && mkdir /ng-app && cp -R ./node_modules ./ng-app
WORKDIR /ng-app
COPY . .
## Build the angular app in production mode and store the artifacts in dist folder
RUN $(npm bin)/ng build --prod --build-optimizer
### STAGE 2: Setup ###
FROM nginx:1.13.3-alpine
## Copy our default nginx config
COPY nginx/default.conf /etc/nginx/conf.d/
## Remove default nginx website
RUN rm -rf /usr/share/nginx/html/*
## From 'builder' stage copy over the artifacts in dist folder to default nginx public folder
COPY --from=builder /ng-app/dist /usr/share/nginx/html
CMD ["nginx", "-g", "daemon off;"]
Now, as the project have the environment files I need to find a way that I can pass those parameters like "enviroment" variables of the docker containers, example docker run -e VARIABLE=VALUE myImage
So, I infer that I will need to set those values inside the environment file before make the compilation, but I don't know how to achieve it. I would like to get some help on this matter, and thank you very much in advance