Commit 65b219c7 authored by Sheogorath's avatar Sheogorath 🎓

Add CI chain and image deployment

parent b0ffe51b
image: quay.io/sheogorath/ubuntu-ci:18.04
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
build-master:
stage: build
variables:
DOCKER_HOST: "tcp://docker:2375"
DOH_VERSION: "2.0.1"
script:
- docker build --pull --build-arg VERSION="$DOH_VERSION" -t "doh:testing" .
- ./tools/tagging.sh "$CI_REGISTRY_IMAGE" "${DOH_VERSION:-latest}" ""
- docker images --format "{{.Repository}}:{{.Tag}}" "$CI_REGISTRY_IMAGE" | xargs -L 1 docker push
only:
- master
tags:
- docker
build:
stage: build
variables:
DOCKER_HOST: "tcp://docker:2375"
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except:
- master
tags:
- docker
FROM golang
ARG VERSION=master
RUN true \
&& git clone https://github.com/m13253/dns-over-https.git \
&& git clone https://github.com/m13253/dns-over-https.git --depth 1 -b "$VERSION" \
&& cd dns-over-https \
&& make \
&& true
......
#!/bin/sh
if [ "$1" = "--help" ]; then
echo "
Usage of $0:
$0 <PREFIX> <VERSION> <SUFFIX>
Example:
$0 doh 2.0.24 alpine
"
fi
PREFIX=${1:-doh}
VERSION=${2}
[ "${3}" != "" ] && [ "${3}" != "debian" ] && SUFFIX="-${3}"
if [ "$VERSION" != "" ]; then
docker tag doh:testing "$PREFIX:$(echo "${VERSION}" | sed -e 's/^v//' | cut -d. -f1)${SUFFIX}"
docker tag doh:testing "$PREFIX:$(echo "${VERSION}" | sed -e 's/^v//' | cut -d. -f1-2)${SUFFIX}"
docker tag doh:testing "$PREFIX:$(echo "${VERSION}" | sed -e 's/^v//' | cut -d. -f1-3)${SUFFIX}"
docker tag doh:testing "$PREFIX:$(echo "${VERSION}" | sed -e 's/^v//' | cut -d. -f1-4)${SUFFIX}"
[ "$SUFFIX" = "" ] && docker tag doh:testing "$PREFIX:latest"
else
echo "No version provided. Skipping tagging..."
fi
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