Skip to content

Commit

Permalink
Allow building and pushing image via GitLab CI
Browse files Browse the repository at this point in the history
Override these environment variables in "Projects / Variables" section
to push to a private repository:
* DOCKER_REGISTRY_HOST - defaults to hub.docker.com
* DOCKER_IMAGE - defaults to sameersbn/gitlab
  • Loading branch information
Peter Suschlik committed Feb 25, 2016
1 parent 7fc1631 commit 9f01c0f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
image: gitlab/dind

deploy:
script:
- ci/gitlab
15 changes: 15 additions & 0 deletions ci/gitlab
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

set -e

VERSION=$(cat VERSION)
DOCKER_REGISTRY_HOST=${DOCKER_REGISTRY_HOST:-hub.docker.com}
DOCKER_IMAGE=${DOCKER_IMAGE:-sameersbn/gitlab}

docker build -t $DOCKER_IMAGE .

docker tag $DOCKER_IMAGE $DOCKER_REGISTRY_HOST/$DOCKER_IMAGE:latest
docker tag $DOCKER_IMAGE $DOCKER_REGISTRY_HOST/$DOCKER_IMAGE:$VERSION

docker push $DOCKER_REGISTRY_HOST/$DOCKER_IMAGE:latest
docker push $DOCKER_REGISTRY_HOST/$DOCKER_IMAGE:$VERSION

0 comments on commit 9f01c0f

Please sign in to comment.