From d27f3b6ad395cf6eb0ed4bf59aa9fdfdb92fbb0f Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sat, 14 Aug 2021 16:58:08 +0100 Subject: [PATCH] Tools: Added option to push Docker images to DockerHub or not --- .github/scripts/run_ci.sh | 2 +- packages/tools/buildServerDocker.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/scripts/run_ci.sh b/.github/scripts/run_ci.sh index 241939e81..b8652dc6b 100755 --- a/.github/scripts/run_ci.sh +++ b/.github/scripts/run_ci.sh @@ -134,7 +134,7 @@ if [[ $GIT_TAG_NAME = v* ]]; then elif [[ $GIT_TAG_NAME = server-v* ]] && [[ $IS_LINUX = 1 ]]; then echo "Step: Building Docker Image..." cd "$ROOT_DIR" - npm run buildServerDocker -- --tag-name $GIT_TAG_NAME + npm run buildServerDocker -- --tag-name $GIT_TAG_NAME --push-images else echo "Step: Building but *not* publishing desktop application..." USE_HARD_LINKS=false npm run dist -- --publish=never diff --git a/packages/tools/buildServerDocker.ts b/packages/tools/buildServerDocker.ts index f65e31b50..6900548fb 100644 --- a/packages/tools/buildServerDocker.ts +++ b/packages/tools/buildServerDocker.ts @@ -16,6 +16,7 @@ async function main() { const argv = require('yargs').argv; if (!argv.tagName) throw new Error('--tag-name not provided'); + const pushImages = !!argv.pushImages; const tagName = argv.tagName; const isPreRelease = getIsPreRelease(tagName); const imageVersion = getVersionFromTag(tagName, isPreRelease); @@ -38,6 +39,7 @@ async function main() { console.info(`Running from: ${process.cwd()}`); console.info('tagName:', tagName); + console.info('pushImages:', pushImages); console.info('imageVersion:', imageVersion); console.info('isPreRelease:', isPreRelease); console.info('Docker tags:', dockerTags.join(', ')); @@ -45,7 +47,7 @@ async function main() { await execCommand2(`docker build -t "joplin/server:${imageVersion}" ${buildArgs} -f Dockerfile.server .`); for (const tag of dockerTags) { await execCommand2(`docker tag "joplin/server:${imageVersion}" "joplin/server:${tag}"`); - await execCommand2(`docker push joplin/server:${tag}`); + if (pushImages) await execCommand2(`docker push joplin/server:${tag}`); } }