File size: 593 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env node

/**
 * Script to run docker build.
 *
 * This script is needed to enable us to embed the git SHA as a build arg
 * in both unix shells and windows.
 *
 * Essentially, it doees this:
 * docker build --build-arg commit_sha=`git rev-parse HEAD` -t wp-calypso .
 */

const { spawnSync, execSync } = require( 'child_process' );

const sha = String( execSync( 'git rev-parse HEAD' ) ).trim();

const args = [ 'build', '--build-arg', 'commit_sha=' + sha, '-t', 'wp-calypso', '.' ];

console.log( 'docker ' + args.join( ' ' ) );
spawnSync( 'docker', args, { stdio: 'inherit' } );