1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Tools: Added option to push Docker images to DockerHub or not

This commit is contained in:
Laurent Cozic 2021-08-14 16:58:08 +01:00
parent 8063c94ff7
commit d27f3b6ad3
2 changed files with 4 additions and 2 deletions

View File

@ -134,7 +134,7 @@ if [[ $GIT_TAG_NAME = v* ]]; then
elif [[ $GIT_TAG_NAME = server-v* ]] && [[ $IS_LINUX = 1 ]]; then elif [[ $GIT_TAG_NAME = server-v* ]] && [[ $IS_LINUX = 1 ]]; then
echo "Step: Building Docker Image..." echo "Step: Building Docker Image..."
cd "$ROOT_DIR" cd "$ROOT_DIR"
npm run buildServerDocker -- --tag-name $GIT_TAG_NAME npm run buildServerDocker -- --tag-name $GIT_TAG_NAME --push-images
else else
echo "Step: Building but *not* publishing desktop application..." echo "Step: Building but *not* publishing desktop application..."
USE_HARD_LINKS=false npm run dist -- --publish=never USE_HARD_LINKS=false npm run dist -- --publish=never

View File

@ -16,6 +16,7 @@ async function main() {
const argv = require('yargs').argv; const argv = require('yargs').argv;
if (!argv.tagName) throw new Error('--tag-name not provided'); if (!argv.tagName) throw new Error('--tag-name not provided');
const pushImages = !!argv.pushImages;
const tagName = argv.tagName; const tagName = argv.tagName;
const isPreRelease = getIsPreRelease(tagName); const isPreRelease = getIsPreRelease(tagName);
const imageVersion = getVersionFromTag(tagName, isPreRelease); const imageVersion = getVersionFromTag(tagName, isPreRelease);
@ -38,6 +39,7 @@ async function main() {
console.info(`Running from: ${process.cwd()}`); console.info(`Running from: ${process.cwd()}`);
console.info('tagName:', tagName); console.info('tagName:', tagName);
console.info('pushImages:', pushImages);
console.info('imageVersion:', imageVersion); console.info('imageVersion:', imageVersion);
console.info('isPreRelease:', isPreRelease); console.info('isPreRelease:', isPreRelease);
console.info('Docker tags:', dockerTags.join(', ')); 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 .`); await execCommand2(`docker build -t "joplin/server:${imageVersion}" ${buildArgs} -f Dockerfile.server .`);
for (const tag of dockerTags) { for (const tag of dockerTags) {
await execCommand2(`docker tag "joplin/server:${imageVersion}" "joplin/server:${tag}"`); 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}`);
} }
} }