title: Create config file when running Docker container with Compose
body: <p>I have the following <code>Dockerfile</code></p>
  
  <pre><code>FROM node:10.8.0-alpine as builder
  
  # Set working directory
  RUN mkdir /usr/src
  RUN mkdir /usr/src/app
  WORKDIR /usr/src/app
  
  # Add /usr/src/app/node_modules/.bin to $PATH
  ENV PATH /usr/src/app/node_modules/.bin:$PATH
  
  # Get build arguments coming from .env file
  ARG API_URL
  ENV API_URL "$API_URL"
  
  # Create config file from environment variables
  RUN echo "API_URL = $API_URL" &gt; ./app.cfg
  
  # Install and cache app dependencies
  COPY package.json /usr/src/app/package.json
  RUN npm install
  RUN npm install react-scripts@1.1.1 -g
  COPY . /usr/src/app
  RUN npm run build
  
  # Production environment
  FROM nginx:1.15.2-alpine
  COPY --from=builder /usr/src/app/build /usr/share/nginx/html
  CMD ["nginx", "-g", "daemon off;"]
  </code></pre>
  
  <p>And I use the following <code>docker-compose.yml</code> file to build my Docker image</p>
  
  <pre><code>version: '3'
  services:
  
    app:
      container_name: data-quality-app
      restart: always
      image: data-quality-app
      build:
        context: ./app
        dockerfile: Dockerfile
        args:
          - API_URL=${API_URL}
      env_file:
        - ./.env
      ports:
        - 80:80
      networks:
        - default
  
  networks:
    default:
      external:
        name: data-quality-network
  
  volumes:
    data-quality-db-volume:
      external: true
  </code></pre>
  
  <p>Note the file <code>.env</code> contains the environment variable <code>API_URL=http://0.0.0.0:5433/graphql</code></p>
  
  <p>All this works pretty well, but when I run my container with Docker Compose:</p>
  
  <p><code>$ docker-compose up app</code></p>
  
  <p>I would like to overwrite the file <code>app.cfg</code> in the container in order to replace the value of <code>API_URL</code> by its current value in the file <code>.env</code>.</p>
  
  <p>I have tried to add the following <code>ENTRYPOINT</code> in <code>Dockerfile</code> but it did not work:</p>
  
  <pre><code>[...]
  # Create config file to from environment variables
  RUN echo "API_URL = $API_URL" &gt; ./app.cfg
  ENTRYPOINT echo "API_URL = $API_URL" &gt; ./app.cfg
  [...]
  </code></pre>
  
  <p>What am I missing?</p>