aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/docker.ts
blob: 42cd36647d743508c5f9491a9fe3b35e72fb5132 (plain)
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
31
32
33
34
import { Command } from 'commander';
import { logger } from '../lib/logger';
import { parsePositiveInt, parseVersion } from './utils';
import { bake } from './utils/docker';

const program = new Command('pnpm build:docker');

program
  .command('build')
  .description('Build docker images')
  .option('--platform <type>', 'docker platforms to build')
  .option('--version <version>', 'version to use as tag', parseVersion)
  .option('--tries <tries>', 'number of tries on failure', parsePositiveInt)
  .option(
    '--delay <delay>',
    'delay between tries for docker build (eg. 5s, 10m, 1h)',
    '30s',
  )
  .action(async (opts) => {
    logger.info('Building docker images ...');
    await bake('build', opts);
  });

program
  .command('push')
  .description('Publish docker images')
  .option('--platform <type>', 'docker platforms to build')
  .option('--version <version>', 'version to use as tag', parseVersion)
  .action(async (opts) => {
    logger.info('Publishing docker images ...');
    await bake('push', opts);
  });

void program.parseAsync();