Reputation: 1496
I have a project that I maintain using Dockerfile. It is a data science project so and the docker can be used in many environments, local, in the cloud, with or without GPU.
The difference between the GPU and the non-GPU version is very small, just this:
FROM ubuntu:18.04 -> non-GPU
FROM nvidia/cuda -> GPU
What is the best way to handle this scenario?
P.S: I am using docker-compose to build the docker
Upvotes: 0
Views: 417
Reputation: 739
You can use multiple docker files inside your docker-compose yml file as below,
├── docker-compose.yml
├── GPU project
│ └── GPU.Dockerfile
└── NON-GPU project
└── NONGPU.Dockerfile
Also it's possible to get syntax highlighting in VS code by giving files .Dockerfile extension(instead of name) e.g. GPU.Dockerfile, NONGPU.Dockerfile etc.
Upvotes: 2