File size: 676 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const { getDockerConfig, isDockerInstalled } = require( '../lib' );

module.exports = {
	title: 'Memory allocated',
	group: 'Docker',
	description: 'Ensures Docker has enough memory allocated',
	test: async ( { pass, fail, ignore } ) => {
		if ( process.platform !== 'darwin' ) {
			ignore( 'This evaluation only works in OSX' );
			return;
		}

		if ( ! ( await isDockerInstalled() ) ) {
			ignore( 'Docker is not installed' );
			return;
		}

		const { memoryMiB } = await getDockerConfig();
		if ( memoryMiB < 8192 ) {
			fail( 'Docker needs at least 8gb' );
			return;
		}

		pass();
	},
	fix: () => {
		return `Edit Docker configuration and assign 8gb of memory`;
	},
};