I am dockerizing a node application.
This is the Dockerfile that I am using:
FROM node:10-slim
# Sets environment variable
ENV NODE_ENV production
# Sets work directory
WORKDIR /usr/src/app
# Copy package.json
COPY ["package.json", "./"]
# Installs dependencies
RUN npm install
# Copy working files
COPY . /usr/src/app
EXPOSE 80
# Starts run command
CMD npm start
But then, since I have several .env files, I would like to pass an argument to choose which env file I will use.
Like this
npm start -- --env="test"
So what I ultimately want is
docker run -p 8080:8080 test/nodeapp:1.0 -- -evn="test"
How should I override the CMD
on docker run?