feat: Add server-level GPU support for Docker Swarm deployments and API endpoint for setup

This commit is contained in:
vishalkadam47
2024-10-17 15:45:27 +05:30
parent fe19cdb5e4
commit 15a76d2639
3 changed files with 20 additions and 0 deletions

View File

@@ -37,3 +37,6 @@ export const paths = (isServer = false) => {
REGISTRY_PATH: `${BASE_PATH}/registry`,
};
};
export const GPU_ENABLED = process.env.GPU_ENABLED === 'true';
export const GPU_RESOURCE_NAME = 'DOCKER_RESOURCE_GPU';

View File

@@ -0,0 +1,9 @@
import { docker } from '../constants';
export async function setupGPUSupport() {
await docker.swarmUpdate({
TaskDefaults: {
GenericResources: [{ DiscreteResourceSpec: { Kind: 'gpu', Value: 1 } }]
}
});
}