Docker Community Forums

Share and learn in the Docker community.

How do i have docker build choose one config file for dev build and another for testing?

I am working on a react based web app. The app contains client, server and db on different docker containers. I have dockerfiles for each and I use a docker compose script to automate.
There is a need to use one config file for client’s Dev build and another for client’s Testing Build.

How do I make this happen?

My client dockerfile looks like this:

FROM node:13.14.0-alpine
WORKDIR /app/
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json /app/
COPY package-lock.json /app/
RUN npm install
COPY . /app/
EXPOSE 3000
CMD [ "npm", "start" ]

My docker-compose.yml looks like this:
version: ‘3’

services:
  test_client:
    build: ./client
    stdin_open: true
    ports:
      - "3000:3000"
    depends_on: 
     - test_db

  test_server:
        blah
 
  dashboard_db:
        blah

Assume that the config files reside in the root client folder.