Repository: Cloud-CV/EvalAI
Issue: Setup: Make Worker and Stasd docker container optional in dev environment.
Root cause: Architectural Constraint

## Issue:

Currently when we run `docker-compose up`, all the containers are spinned up which we don't even need for development. So, make worker and statsd containers as optional.

Here is the code to do it:

```
version: "3.9"
services:
  db:
    image: postgres:10.4
    ports:
      - "5432:5432"

  sqs:
    image: softwaremill/elasticmq
    hostname: sqs
    ports:
      - 9324:9324

  django:
    hostname: django
    env_file:
      - docker/dev/docker.env
    build:
      context: ./
      dockerfile: docker/dev/django/Dockerfile
    ports:
      - "8000:8000"
    depends_on:
      - db
      - sqs
      - statsd-exporter
    volumes:
      - .:/code

  worker:
    env_file:
      - docker/dev/docker.env
    image: my_custom_worker_image  # Default image used if not built
    build:
      context: ./
      dockerfile: docker/dev/worker/Dockerfile
      x-enabled: ${BUILD_WORKER:-false}  # Only build if BUILD_WORKER=true
    depends_on:
      - django
    volumes:
      - .:/code
    profiles:
      - worker  # Only built when this profile is specified

  worker_py3_8:
    env_file:
      - docker/dev/docker.env
    image: my_custom_worker_py3_8_image  # Default image used if not built
    build:
      context: ./
      dockerfile: docker/dev/worker_py3.8/Dockerfile
      x-enabled: ${BUILD_WORKER:-false}
    depends_on:
      - django
    volumes:
      - .:/code
    profiles:
      - worker

  nodejs:
    hostname: nodejs
    build:
      context: ./
      dockerfile: docker/dev/nodejs/Dockerfile
    environment:
      NODE_ENV: development
    ports:
      - "8888:8888"
      - "35729:35729"
    volumes:
      - .:/code
      - /code/node_modules
      - /code/bower_components

  statsd-exporter:
    hostname: statsd
    image: prom/statsd-exporter:latest
    build:
      context: ./
      dockerfile: docker/dev/statsd-exporter/Dockerfile
      x-enabled: ${BUILD_STATSD:-false}  # Only build if BUILD_STATSD=true
    command:
      - '--log.level=info'
      - '--web.telemetry-path=/statsd/metrics'
    ports:
      - '9125:9125'
      - '9102:9102'
    profiles:
      - statsd  # Only built when this profile is specified
```

## Deliverables:

- [ ] Use the code to check if it works correctly. If not, fix it.
- [ ] Add documentation for it in the readme for running the containers.




Hey @RishabhJain2018 , Using Docker Compose `profiles` , we can mark optional services("`worker`" and "`stastsd-exporter`") and when we need it then we can do 
**`docker-compose --profile worker --profile statsd up`** 

As working in Development , if we don't need `statsd-exporter` for Django Services then we can remove that from "`depends_on`" list from `django` service


If I get what You are trying to say , just let me know the further procedure , This is my first contribution in Github and also in the CloudCV (EvalAI) Repo . So please help me to understand it better . Thank you 


Hey @CoderRahul01 , Sure, Please go ahead with the changes.

I have submitted a PR to resolve this issue: #4498.  
Please review it when you get a chance. Thanks!

Hey @ilyasd3 , Thanks for the PR. I'll review it this time but from next time, please make sure to comment here before, so that we know you are working on it. Thanks!

Hey @CoderRahul01 , Please pick any other issue. This issue is almost resolved.

> Hey [@ilyasd3](https://github.com/ilyasd3) , Thanks for the PR. I'll review it this time but from next time, please make sure to comment here before, so that we know you are working on it. Thanks!

Ahh got it, my apologies! This was my first contribution on GitHub, so I wasn’t too familiar with the process. I’ll make sure to comment on the issue before working on it next time. Thanks for the guidance!