My Docker compose file is as follows
environment:
external:
name: dev
services:
app:
deploy:
replicas: 1
environment:
NODE_ENV: development
Compose Swarm is as follows:
version: "3.3"
services:
app:
image: "${IMAGE_NAME}"
networks:
- environment
environment:
NODE_ENV: ${ENVIRONMENT}
PORT: 8080
deploy:
resources:
limits:
cpus: "0.20"
memory: 1500M
reservations:
cpus: "0.20"
memory: 100M
My docker file is as follows:
FROM node:10.16.3-alpine
USER node
RUN npm install
RUN pwd
RUN ls -lah
RUN npm run buildconfigs ${NODE_ENV}
EXPOSE 8080
CMD ["node", "app.js"]
`
I would like my RUN npm run buildconfigs ${NODE_ENV} in the docker file to be replaced to
RUN npm run buildconfigs development.
I am not sure why ${NODE_ENV} is not getting picked up from compose file. Would appreciate a direction on how to capture compose file variable in the docker file. Thank you