Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1 from nuest/master
Browse files Browse the repository at this point in the history
update for automated build with version tags
  • Loading branch information
nuest authored Jul 19, 2018
2 parents 538a360 + 6fa2f59 commit 0cc59d5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,16 @@ COPY index.js index.js
COPY controllers controllers
COPY controllers/bindings.js controllers/bindings.js

# Metadata http://label-schema.org/rc1/
LABEL maintainer="o2r-project <https://o2r.info>" \
org.label-schema.vendor="o2r project" \
org.label-schema.url="http://o2r.info" \
org.label-schema.name="o2r bindings" \
org.label-schema.description="linking data, text, and code for research transparency" \
org.label-schema.version=$VERSION \
org.label-schema.vcs-url=$VCS_URL \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.docker.schema-version="rc1"

CMD ["node", "index.js"]
12 changes: 12 additions & 0 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e

PACKAGE_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json)

echo "Build hook running for version" $PACKAGE_VERSION
docker build \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg VCS_URL=`git config --get remote.origin.url` \
--build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` \
--build-arg VERSION=$PACKAGE_VERSION \
-t $IMAGE_NAME .
8 changes: 8 additions & 0 deletions hooks/post_push
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e

PACKAGE_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json)
echo Add version tag using $PACKAGE_VERSION

docker tag $IMAGE_NAME $DOCKER_REPO:$PACKAGE_VERSION
docker push $DOCKER_REPO:$PACKAGE_VERSION

0 comments on commit 0cc59d5

Please sign in to comment.