Skip to content

Commit

Permalink
Merge pull request #190 from stawik-mesa/187-docker-image-versions
Browse files Browse the repository at this point in the history
187 docker image versions
  • Loading branch information
xeronimus authored Jun 15, 2021
2 parents 17e812d + 747d46f commit f6bfd1f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ os: linux
services:
- docker

addons:
apt:
packages:
- docker-ce

language: node_js

node_js:
Expand All @@ -30,9 +25,10 @@ script:
- npm test
- npm run build

# --all-tags was introduced in version v20.10, older versions pushed all images automatically if no tag was provided
after_success:
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
docker -v;
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin;
docker image push xeronimus/poinz:latest;
docker image push --all-tags "${DOCKER_USERNAME}/poinz" || docker image push "${DOCKER_USERNAME}/poinz";
fi
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@ You can contribute in multiple ways...

* Maybe you have a feature request? Found a bug? General feedback? Please open a new [issue](https://github.com/Zuehlke/poinz/issues)
* You want to extend Poinz? Or fix one of the issues? Check out the [Technical documentation](./docu/technicalDocu.md).


23 changes: 13 additions & 10 deletions build/dockerImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,27 @@ function spawnAndPrint(command, args, options) {
}

function startBuildingDockerImage(gitInfo) {
console.log(`building docker container for ${gitInfo.hash} on ${gitInfo.branch}`);
console.log(`building docker container for ${gitInfo.hash} on ${gitInfo.branch} (git-tags: ${gitInfo.tags.join(' ')})`);

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

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

function getGitInformation() {
return Promise.all([
execPromised('git rev-parse --abbrev-ref HEAD', {cwd: __dirname}),
execPromised('git rev-parse --short HEAD', {cwd: __dirname})
]).spread((abbrev, short) => ({
branch: abbrev.split('\n').join(''),
hash: short.split('\n').join('')
execPromised('git rev-parse --abbrev-ref HEAD', {cwd: __dirname}), // This will return `HEAD` if in detached mode
execPromised('git rev-parse --short HEAD', {cwd: __dirname}),
execPromised('git tag --points-at HEAD', {cwd: __dirname})
]).spread((abbrev, short, tags) => ({
branch: process.env.TRAVIS_BRANCH || abbrev.split('\n').join(''),
hash: short.split('\n').join(''),
tags: tags.split('\n').filter( n => n)
}));
}

0 comments on commit f6bfd1f

Please sign in to comment.