0

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

user11380842
  • 43
  • 3
  • 8
  • 1
    Please format your compose file as a code sample. There is formatting help available when editing your question. – larsks May 13 '20 at 00:44
  • Also, please provide the full compose file, the command you are running, the output, and the expected result. – Andy Shinn May 13 '20 at 01:50
  • Thanks. Updated as code block. I am running RUN npm run buildconfigs ${NODE_ENV} and expected output is RUN npm run buildconfigs development – user11380842 May 13 '20 at 02:24

0 Answers0