Skip to content

Commit

Permalink
Merge pull request #33 from mageddo/travis
Browse files Browse the repository at this point in the history
Travis
  • Loading branch information
mageddo authored Sep 9, 2017
2 parents 4108104 + 144b5ee commit e35424c
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 338 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
sudo: required
language: go

services:
- docker

install:

- source ./builder setup-repository
- ./gradlew release -Prelease.releaseVersion=`cat VERSION` -Prelease.newVersion=`cat VERSION`

script: docker-compose up --abort-on-container-exit prod-build-dns-proxy-server

after_success:
- source ./builder upload-release
- source ./builder dockerhub-build

branches:
only:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.hub
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM debian:8
WORKDIR /app
ENV TMP_NAME=/tmp/dns-proxy-server.tgz
RUN apt-get update && apt-get install -y curl
RUN curl -L https://github.com/mageddo/dns-proxy-server/releases/download/2.1.2/dns-proxy-server-2.1.2.tgz > $TMP_NAME && \
RUN curl -L https://github.com/mageddo/dns-proxy-server/releases/download/2.1.3/dns-proxy-server-2.1.3.tgz > $TMP_NAME && \
tar -xvf $TMP_NAME -C /app/ && rm -f $TMP_NAME

VOLUME ["/var/run/docker.sock", "/var/run/docker.sock"]
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.2
2.1.5
44 changes: 0 additions & 44 deletions build.gradle

This file was deleted.

37 changes: 10 additions & 27 deletions builder
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

set -e

CUR_DIR=`pwd`
APP_VERSION=$(cat VERSION)
REPO_URL=mageddo/dns-proxy-server

create_release(){

PAYLOAD=`echo '{
Expand All @@ -21,31 +25,19 @@ upload_file(){
"https://uploads.github.com/repos/$REPO_URL/releases/$TAG_ID/assets?name=$TARGET_FILE&access_token=$REPO_TOKEN"
}


CUR_DIR=$PWD
APP_VERSION=$(cat VERSION)
REPO_URL=mageddo/dns-proxy-server

case $1 in


setup-repository )
git remote remove origin && git remote add origin https://${REPO_TOKEN}@github.com/$REPO_URL.git
git checkout -b build_branch ${TRAVIS_BRANCH}
echo "> Repository added, travisBranch=${TRAVIS_BRANCH}"

;;

dockerhub-build )

PAYLOAD=`echo '{"source_type": "Tag", "source_name": "VERSION"}' | sed -e "s/VERSION/${APP_VERSION}/"`
curl -f -s -i -H 'Content-Type: application/json' --data "$PAYLOAD" -X POST \
https://registry.hub.docker.com/u/defreitas/bookmark-notes/trigger/$DOCKER_TOKEN/

;;

upload-release )

git commit -am "Releasing ${APP_VERSION}"
git tag ${APP_VERSION}
git push origin "build_branch:${TRAVIS_BRANCH}"
git status
echo "> Branch pushed - Branch $TRAVIS_BRANCH"
Expand All @@ -62,21 +54,12 @@ https://registry.hub.docker.com/u/defreitas/bookmark-notes/trigger/$DOCKER_TOKEN

;;

pull-all )
git pull
for i in `git submodule | awk '{print $2}'`; do
MATCH=`echo $i | grep -o "mageddo"`
MATCH2=`echo $i | grep -o "ElvisDeFreitas"`

echo "pulling $i"
cd $i
git pull
cd $CUR_DIR
build )

done;
;;

build )
# updating files version
sed -i -E "s/(dns-proxy-server.*)[0-9]+\.[0-9]+\.[0-9]+/\1$APP_VERSION/" docker-compose.yml
sed -i -E "s/[0-9]+\.[0-9]+\.[0-9]+/$APP_VERSION/g" Dockerfile.hub

echo "> Starting build"

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
network_mode: bridge
prod-docker-dns-prod-server: # run from a docker image
container_name: dns-proxy-server
image: defreitas/dns-proxy-server:2.1.2
image: defreitas/dns-proxy-server:2.1.3
hostname: dns.mageddo
volumes:
- /opt/dns-proxy-server/conf:/app/conf
Expand All @@ -31,7 +31,7 @@ services:
context: .
dockerfile: Dockerfile
container_name: docker-dns-server-docker-compiler
image: defreitas/dns-proxy-server:2.1.2
image: defreitas/dns-proxy-server:2.1.3
prod-build-dns-proxy-server: # build the binary
extends: gocompiler-docker-dns-proxy
container_name: docker-dns-server-compiler
Expand Down
1 change: 0 additions & 1 deletion gradle.properties

This file was deleted.

Binary file removed gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 0 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties

This file was deleted.

169 changes: 0 additions & 169 deletions gradlew

This file was deleted.

Loading

0 comments on commit e35424c

Please sign in to comment.