Commit 489d0554 authored by zauberstuhl's avatar zauberstuhl
Browse files

Implement docker auto build images

parent 6e7d0bd1
image: debian:stable
before_script:
- apt-get update
- apt-get install -y curl git-core
- curl -fsSL https://get.docker.com | bash
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
build:
stage: build
script:
- bash .gitlab/ci/scripts/run.sh
except:
- master
push:
stage: deploy
script:
- bash .gitlab/ci/scripts/run.sh deploy
only:
- master
#!/bin/bash
deploy=$([ "$1" == "deploy" ] && echo 1 || echo 0);
registry="registry.git.feneas.org/feneas/infrastructure/docker-images";
for dir in $(ls); do
if [ -d "$dir" ]; then
version=$(git tag -l "*-${dir}" --sort=-refname \
| head -1 | sed "s/^\(.*\)-${dir}/\1/");
if [ "$version" != "" ] && [ -f "$dir/Dockerfile" ]; then
echo -ne "\n\nSTART BUILDING ${dir}:${version}\n\n"
docker build -t ${registry}/${dir}:${version} ${dir}
docker tag ${registry}/${dir}:${version} ${registry}/${dir}:latest
if [ "$deploy" == "1" ]; then
echo -ne "\n\nDEPLOYING ${dir}:${version}\n\n"
docker push ${registry}/${dir}:${version}
docker push ${registry}/${dir}:latest
fi
fi
fi
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment