title: Pass environment variables from docker-compose to vue app with nginx
body: <p>I want to dockerize my vuejs app and to pass it environment variables from the docker-compose file.</p>
  
  <p>I suspect the app gets the environment variables only at the build stage, so it does not get the environment variables from the docker-compose.</p>
  
  <p>vue app:</p>
  
  <pre><code>process.env.FIRST_ENV_VAR
  </code></pre>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM alpine:3.7
  
  RUN apk add --update nginx nodejs
  
  RUN mkdir -p /tmp/nginx/vue-single-page-app
  RUN mkdir -p /var/log/nginx
  RUN mkdir -p /var/www/html
  
  COPY nginx_config/nginx.conf /etc/nginx/nginx.conf
  COPY nginx_config/default.conf /etc/nginx/conf.d/default.conf
  
  WORKDIR /tmp/nginx/vue-single-page-app
  
  COPY . .
  
  RUN npm install
  
  RUN npm run build
  
  RUN cp -r dist/* /var/www/html
  
  RUN chown nginx:nginx /var/www/html
  
  CMD ["nginx", "-g", "daemon off;"]
  </code></pre>
  
  <p>docker-compose:</p>
  
  <pre><code>version: '3.6'
  
  services:
  
    app:
      image: myRegistry/myProject:tag
      restart: always
      environment:
        - FIRST_ENV_VAR="first environment variable"
        - SECOND_ENV_VAR="first environment variable"
      ports:
        - 8080:8080
  </code></pre>
  
  <p>Is there any way to pass environment variables to a web application after the build stage?</p>