Skip to content

Commit

Permalink
Tools: Added option to push Docker images to DockerHub or not
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Aug 14, 2021
1 parent 8063c94 commit d27f3b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/run_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion packages/tools/buildServerDocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -38,14 +39,15 @@ 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(', '));

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}`);
}
}

Expand Down

0 comments on commit d27f3b6

Please sign in to comment.