You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
Chore: Updated script to allow deploying Transcribe server (#12828)
This commit is contained in:
@@ -10,25 +10,28 @@ interface Argv {
|
||||
platform?: string;
|
||||
source?: string;
|
||||
addLatestTag?: boolean;
|
||||
dockerFile?: string;
|
||||
}
|
||||
|
||||
function parseArgv(): Argv {
|
||||
return require('yargs')
|
||||
.scriptName('yarn buildServerDocker')
|
||||
.usage('$0 --repository OWNER/IMAGE [args]')
|
||||
.option('r', {
|
||||
alias: 'repository',
|
||||
.option('dockerFile', {
|
||||
describe: 'Dockerfile - either Dockerfile.server or Dockerfile.transcribe',
|
||||
demandOption: true,
|
||||
type: 'string',
|
||||
})
|
||||
.option('repository', {
|
||||
describe: 'Target image repository. Usually in format `OWNER/NAME`',
|
||||
demandOption: true,
|
||||
type: 'string',
|
||||
})
|
||||
.option('t', {
|
||||
alias: 'tagName',
|
||||
.option('tagName', {
|
||||
describe: 'Base image tag. Usually should be in format `server-v1.2.3` or `server-v1.2.3-beta`. The latest `server-v*` git tag will be used by default.',
|
||||
type: 'string',
|
||||
})
|
||||
.option('l', {
|
||||
alias: 'addLatestTag',
|
||||
.option('addLatestTag', {
|
||||
describe: 'Add `latest` tag even for pre-release images.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
@@ -43,14 +46,12 @@ function parseArgv(): Argv {
|
||||
type: 'string',
|
||||
default: 'https://github.com/laurent22/joplin.git',
|
||||
})
|
||||
.option('p', {
|
||||
alias: 'pushImages',
|
||||
.option('pushImages', {
|
||||
describe: 'Publish images to target repository.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
.option('dryRun', {
|
||||
alias: 'dryRun',
|
||||
describe: 'Do not call docker, just show command instead.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
@@ -80,8 +81,11 @@ async function main() {
|
||||
const argv = parseArgv();
|
||||
if (!argv.tagName) console.info('No `--tag-name` was specified. A latest git tag will be used instead.');
|
||||
|
||||
console.info('Raw arguments:', argv);
|
||||
|
||||
const dryRun = argv.dryRun;
|
||||
const addLatestTag = argv.addLatestTag;
|
||||
const dockerFile = argv.dockerFile;
|
||||
const pushImages = argv.pushImages;
|
||||
const repository = argv.repository;
|
||||
const tagName = argv.tagName || `server-${await execCommand('git describe --tags --match v*', { showStdout: false })}`;
|
||||
@@ -123,6 +127,7 @@ async function main() {
|
||||
process.chdir(rootDir);
|
||||
console.info(`Running from: ${process.cwd()}`);
|
||||
|
||||
console.info('dockerFile:', dockerFile);
|
||||
console.info('repository:', repository);
|
||||
console.info('tagName:', tagName);
|
||||
console.info('platform:', platform);
|
||||
@@ -138,7 +143,7 @@ async function main() {
|
||||
if (pushImages) {
|
||||
cliArgs.push('--push');
|
||||
}
|
||||
cliArgs.push('-f Dockerfile.server');
|
||||
cliArgs.push(`--file ${dockerFile}`);
|
||||
cliArgs.push('.');
|
||||
|
||||
const dockerCommand = `docker buildx build ${cliArgs.join(' ')}`;
|
||||
|
||||
Reference in New Issue
Block a user