Skip to content
Snippets Groups Projects
Commit fd573a3b authored by Christoph Hartmann's avatar Christoph Hartmann
Browse files

allow local image building without pushing

parent ba5021a8
No related branches found
No related tags found
No related merge requests found
sudo: required sudo: required
services: services:
- docker - docker
language: go language: go
...@@ -34,7 +34,7 @@ script: ...@@ -34,7 +34,7 @@ script:
deploy: deploy:
provider: script provider: script
script: "./build-docker-push" script: "./build-docker push"
skip_cleanup: true skip_cleanup: true
on: on:
branch: master branch: master
......
...@@ -34,10 +34,16 @@ You can also use a copy of `go` hosted inside a Docker container if you prefix y ...@@ -34,10 +34,16 @@ You can also use a copy of `go` hosted inside a Docker container if you prefix y
Once binaries are compiled you can build and push a dex image to quay.io. Before doing this step binaries must be built above using one of the build tools. Once binaries are compiled you can build and push a dex image to quay.io. Before doing this step binaries must be built above using one of the build tools.
```console
./build-docker build
```
If you want to push the build to quay.io, use `./build-docker push`:
```console ```console
export DOCKER_USER=<<your user>> export DOCKER_USER=<<your user>>
export DOCKER_PASSWORD=<<your password>> export DOCKER_PASSWORD=<<your password>>
./build-docker-push ./build-docker push
``` ```
By default the script pushes to `quay.io/coreos/dex`; if you want to push to a different repository, override the `DOCKER_REGISTRY` and `DOCKER_REPO` environment variables. By default the script pushes to `quay.io/coreos/dex`; if you want to push to a different repository, override the `DOCKER_REGISTRY` and `DOCKER_REPO` environment variables.
...@@ -102,7 +108,7 @@ Note that __all of these flags are manditory__. This should add an entry to the ...@@ -102,7 +108,7 @@ Note that __all of these flags are manditory__. This should add an entry to the
## Updating an existing package ## Updating an existing package
To update an existing package, edit the `glide.yaml` file to the desired verison (most likely a git hash), and run `glide update`. To update an existing package, edit the `glide.yaml` file to the desired verison (most likely a git hash), and run `glide update`.
``` ```
{{ edit the entry in glide.yaml }} {{ edit the entry in glide.yaml }}
......
#!/bin/bash -e
#
# Build the docker container and push it to quay
# ./build-docker push
#
# Build the docker container locally without pushing to registry
# ./build-docker build
DOCKER_REGISTRY=${DOCKER_REGISTRY:=quay.io}
DOCKER_REPO=${DOCKER_REPO:=coreos/dex}
repo=$DOCKER_REGISTRY/$DOCKER_REPO
version=$(./git-version)
stage() {
echo -e "\033[36m----> $1\033[0m"
}
build() {
stage "build $repo:$version"
docker build -q --rm=true -t $repo:$version .
docker tag $repo:$version $repo:latest
}
push() {
stage "push image $repo:$version"
if [ -v $DOCKER_USER ] || [ -v $DOCKER_PASSWORD ]; then
echo "env variables not set: DOCKER_USER, DOCKER_PASSWORD. skipping login, assuming creds in .dockercfg"
else
echo logging in as $DOCKER_USER
docker login --username="$DOCKER_USER" --password="$DOCKER_PASSWORD" --email="dex@example.com" $DOCKER_REGISTRY
fi
docker push $repo:$version
docker push $repo:latest
}
test -z "$1" && build && push
test "$1" = "push" && build && push
test "$1" = "build" && build
#!/bin/bash -e
DOCKER_REGISTRY=${DOCKER_REGISTRY:=quay.io}
DOCKER_REPO=${DOCKER_REPO:=coreos/dex}
repo=$DOCKER_REGISTRY/$DOCKER_REPO
if [ -v $DOCKER_USER ] || [ -v $DOCKER_PASSWORD ]; then
echo "env variables not set: DOCKER_USER, DOCKER_PASSWORD. skipping login, assuming creds in .dockercfg"
else
echo logging in as $DOCKER_USER
docker login --username="$DOCKER_USER" --password="$DOCKER_PASSWORD" --email="dex@example.com" $DOCKER_REGISTRY
fi
version=$(./git-version)
docker build -q --rm=true -t $repo:$version .
docker tag -f $repo:$version $repo:latest
docker push $repo:$version
docker push $repo:latest
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment