Using GPU on docker compose

I have a docker compose file that consists of nginx and flask app(runnning tensorflow). Something like this:

version: '3.7'

services:
    ...
    flask:
      expose:
        - 6006
#      deploy:
#        resources:
#          limits:
#            gpus: all

    nginx:
      ...
      restart: always
      ports:
        - "6006:80"
     ...

It’s working fine but i wanted to use gpu resources for my flask app. i can run the flask app (docker-container) with gpu, by using the --gpu flag, but this is separate from the nginx container.

Currently, it is not supported for compose 3.7. Issue in github.

Question: What’s the best workaround for running my app? downgrade docker-compose? Can i combine the nginx and flask in same container?

Source: StackOverflow