Skip to content

Commit

Permalink
#187 tag docker image also with version from package.json if on maste…
Browse files Browse the repository at this point in the history
…r branch. push "latest" and "[version]" to docker hub...
  • Loading branch information
[email protected] authored and [email protected] committed Jun 15, 2021
1 parent 8fc9e03 commit 3f1bd96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ script:
after_success:
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
docker login --username="$DOCKER_USERNAME" --password="$DOCKER_PASSWORD";
docker push xeronimus/poinz;
docker push --all-tags xeronimus/poinz;
fi
7 changes: 6 additions & 1 deletion build/dockerImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const fs = Promise.promisifyAll(require('fs-extra'));
const {exec} = require('child_process');
const {spawn} = require('cross-spawn');
const del = require('del');
const pkg = require('../package.json');

const execPromised = Promise.promisify(exec);

Expand Down Expand Up @@ -96,7 +97,11 @@ function startBuildingDockerImage(gitInfo) {
console.log(`building docker container for ${gitInfo.hash} on ${gitInfo.branch}`);

const userAndProject = 'xeronimus/poinz';
const cmdArgs = `build -t ${userAndProject}:latest -t ${HEROKU_DEPLOYMENT_TAG} .`;
const tags = [`${userAndProject}:latest`, HEROKU_DEPLOYMENT_TAG];
if (gitInfo.branch === 'master') {
tags.push(`${userAndProject}:${pkg.version}`);
}
const cmdArgs = `build ${tags.map(tg => '-t ' + tg).join(' ')} .`;

return spawnAndPrint('docker', cmdArgs.split(' '), {cwd: path.resolve(__dirname, '..')});
}
Expand Down

0 comments on commit 3f1bd96

Please sign in to comment.