diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d45db6d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ -sudo: required -language: c - -services: - - docker - -before_install: - - sudo apt-get update - - sudo apt-get install -qy docker-engine - - wget https://github.com/grammarly/rocker/releases/download/1.3.0/rocker_linux_amd64.tar.gz -O /tmp/rocker.tar.gz - - sudo tar -xvzf /tmp/rocker.tar.gz -C /usr/local/bin && sudo chmod +x /usr/local/bin/rocker - - sudo mkdir -m 777 -p /build/amd64 /build/arm - -script: - - if git describe --contains ${TRAVIS_COMMIT} &>/dev/null; then export VERSIONARGS="-var DOCKERIMAGE_VERSION=`git describe --contains ${TRAVIS_COMMIT}`"; else unset VERSIONARGS; fi - - if git describe --contains ${TRAVIS_COMMIT} &>/dev/null; then export VERSION="`git describe --contains ${TRAVIS_COMMIT}`"; else unset VERSION; fi - - rocker build --no-cache ${VERSIONARGS} -var GIT_COMMIT=${TRAVIS_COMMIT} -var OUTPUT_DIR=/build/amd64 -var ARCH=amd64 . - - rocker build --no-cache ${VERSIONARGS} -var GIT_COMMIT=${TRAVIS_COMMIT} -var OUTPUT_DIR=/build/arm -var ARCH=arm . - -after_success: - - sudo mv /build/amd64/dnsdock /build/dnsdock.amd64 - - sudo mv /build/arm/dnsdock /build/dnsdock.arm - - sudo chmod -R a+rw /build - - echo "docker login -u $DOCKER_USER -p $DOCKER_PASSWORD" >> /tmp/deploy_containers.sh - - echo "docker push aacebedo/dnsdock:latest-amd64" >> /tmp/deploy_containers.sh - - echo "docker push aacebedo/dnsdock:latest-arm" >> /tmp/deploy_containers.sh - - echo "docker push aacebedo/dnsdock:$VERSION-amd64" >> /tmp/deploy_containers.sh - - echo "docker push aacebedo/dnsdock:$VERSION-arm" >> /tmp/deploy_containers.sh - - sudo chmod a+rx /tmp/deploy_containers.sh - -deploy: - - provider: releases - skip_cleanup: true - api-key: - secure: $GITHUB_TOKEN - file: /build/dnsdock.amd64 - on: - tags: true - - provider: releases - skip_cleanup: true - api-key: - secure: $GITHUB_TOKEN - file: /build/dnsdock.arm - on: - tags: true - - provider: script - script: /tmp/deploy_containers.sh - on: - tags: true \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cec7176 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +FROM alpine:3.6 AS builder + +ARG GOLANG_VERSION=1.8.4-r0 + +RUN apk update +RUN apk add go=${GOLANG_VERSION} go-tools=${GOLANG_VERSION} git musl-dev +RUN go version + +ENV GOPATH=/go +ENV PATH=${PATH}:/go/bin +ENV CGO_ENABLED=0 + +RUN go get -v github.com/tools/godep +# RUN go get -u github.com/golang/lint/golint +RUN go get github.com/ahmetb/govvv + +RUN mkdir -p /go/src/github.com/p1c2u/dnsdock + +WORKDIR /go/src/github.com/p1c2u/dnsdock + +RUN git clone https://github.com/p1c2u/dnsdock /go/src/github.com/p1c2u/dnsdock +# RUN git checkout {{$GIT_COMMIT}} + +RUN mkdir /tmp/output + +WORKDIR /go/src/github.com/p1c2u/dnsdock + +ENV GIT_SSL_NO_VERIFY=true + +RUN godep restore + +ENV GOARCH=arm64 + +WORKDIR /go/src/github.com/p1c2u/dnsdock/src + +RUN govvv build -o /tmp/output/dnsdock + +FROM alpine:3.18.2 + +COPY --from=builder /tmp/output/dnsdock /bin/dnsdock + +ENTRYPOINT ["dnsdock"] diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index fcab44a..5078d21 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1,5 +1,5 @@ { - "ImportPath": "github.com/aacebedo/dnsdock", + "ImportPath": "github.com/p1c2u/dnsdock", "GoVersion": "go1.6", "GodepVersion": "v74", "Packages": [ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bb70c22 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +build: + docker build -t dnsdock:latest . + +build-test: + docker build -t dnsdock:test . --progress=plain --no-cache diff --git a/Rockerfile b/Rockerfile deleted file mode 100644 index d434782..0000000 --- a/Rockerfile +++ /dev/null @@ -1,85 +0,0 @@ -# This file is part of DNSDock -# MIT -# -# Copyright (C) 2014 Tõnis Tiigi -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -{{$GOLANG_VERSION := "1.6.3"}} -{{$ARCH:= (or .ARCH "amd64")}} -{{$GIT_COMMIT:= (or .GIT_COMMIT "develop")}} -{{$DOCKERIMAGE_VERSION:= (or .DOCKERIMAGE_VERSION "dev")}} -{{$SRC_DIR:= (or .SRC_DIR ".")}} - -# build image -FROM alpine:3.4 -RUN apk update -RUN apk upgrade -RUN apk add go>{{$GOLANG_VERSION}} go-tools>{{$GOLANG_VERSION}} git musl-dev - -ENV GOPATH=/go -ENV PATH=${PATH}:/go/bin -ENV CGO_ENABLED=0 - -RUN go get -v github.com/tools/godep -RUN go get -u github.com/golang/lint/golint -RUN go get github.com/ahmetb/govvv - -RUN mkdir -p /go/src/github.com/aacebedo/dnsdock -WORKDIR /go/src/github.com/aacebedo/dnsdock -{{if .SRC_DIR}} - MOUNT {{$SRC_DIR}}:/go/src/github.com/aacebedo/dnsdock -{{else}} - RUN git clone https://github.com/aacebedo/dnsdock /go/src/github.com/aacebedo/dnsdock - RUN git checkout {{$GIT_COMMIT}} -{{end}} - -{{if .OUTPUT_DIR}} - MOUNT {{.OUTPUT_DIR}}:/tmp/output -{{else}} - RUN mkdir /tmp/output -{{end}} - -WORKDIR /go/src/github.com/aacebedo/dnsdock -RUN godep restore -ENV GOARCH={{$ARCH}} -WORKDIR /go/src/github.com/aacebedo/dnsdock/src -ATTACH sh -RUN govvv build -o /tmp/output/dnsdock -RUN golint -set_exit_status -{{if eq $ARCH "amd64"}} -RUN go vet -RUN go test ./... -{{end}} -TAG aacebedo/dnsdock-devenv:latest-{{$ARCH}} -EXPORT /tmp/output/dnsdock ./dnsdock - -# run image -{{if eq $ARCH "amd64"}} -FROM alpine -{{else}} -FROM easypi/alpine-arm -{{end}} -IMPORT ./dnsdock /bin/dnsdock -ENTRYPOINT ["dnsdock"] -TAG aacebedo/dnsdock:{{$DOCKERIMAGE_VERSION}}-{{$ARCH}} - -{{if ne $DOCKERIMAGE_VERSION "dev"}} -TAG aacebedo/dnsdock:latest-{{$ARCH}} -{{end}} diff --git a/docker-compose.yml b/docker-compose.yml index dede735..cb111f3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,9 @@ -# /var/run/docker.sock does not seem to be available for fig -# for this reason we violate LFHS and add the socket directly on /run -dnsdock: - image: conz27/dnsdock - container_name: dnsdock - command: -nameserver 192.168.0.1:53 -nameserver 8.8.8.8:53 - volumes: - - /var/run/docker.sock:/run/docker.sock - ports: - - 172.17.0.0:53:53/udp +services: + dnsdock: + image: p1c2u/dnsdock + container_name: dnsdock + command: -nameserver 192.168.0.1:53 -nameserver 8.8.8.8:53 + volumes: + - /var/run/docker.sock:/run/docker.sock + ports: + - 172.17.0.0:53:53/udp diff --git a/readme.md b/readme.md index a547c79..195aa21 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -[![Build Status](https://secure.travis-ci.org/aacebedo/dnsdock.png)](http://travis-ci.org/aacebedo/dnsdock) +[![Build Status](https://secure.travis-ci.org/p1c2u/dnsdock.png)](http://travis-ci.org/p1c2u/dnsdock) ## dnsdock @@ -48,10 +48,10 @@ Install a golang development environment on your host and type the following com export GOPATH=/tmp/go export PATH=${PATH}:${GOPATH}/bin go get -v github.com/tools/godep -go get -d -v https://github.com/aacebedo/dnsdock -cd ${GOPATH}/src/github.com/aacebedo/dnsdock +go get -d -v https://github.com/p1c2u/dnsdock +cd ${GOPATH}/src/github.com/p1c2u/dnsdock godep restore -cd ${GOPATH}/src/github.com/aacebedo/dnsdock/src +cd ${GOPATH}/src/github.com/p1c2u/dnsdock/src go build -o ${GOPATH}/bin/dnsdock ``` @@ -60,7 +60,7 @@ go build -o ${GOPATH}/bin/dnsdock To build with docker you need [rocker](https://github.com/grammarly/rocker). Check the website to install it and type the following commands: ``` -git clone https://github.com/aacebedo/dnsdock +git clone https://github.com/p1c2u/dnsdock rocker build -var ARCH=[amd64|arm] -var OUTPUT_DIR= ``` @@ -123,7 +123,7 @@ Restart docker daemon after you have done that (`sudo service docker restart`). Now you only need to run the dnsdock container: ``` -docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name dnsdock -p 172.17.0.1:53:53/udp aacebedo/dnsdock [--opts] +docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name dnsdock -p 172.17.0.1:53:53/udp p1c2u/dnsdock [--opts] ``` - `-d` starts container as daemon @@ -159,7 +159,7 @@ If you also want to let the host machine discover the containers add `nameserver Mounting docker daemon's unix socket may not work with default configuration on these platforms. Please use [selinux-dockersock](https://github.com/dpw/selinux-dockersock) to fix this. -More information in [#11](https://github.com/aacebedo/dnsdock/issues/11). +More information in [#11](https://github.com/p1c2u/dnsdock/issues/11). #### TLS Authentication @@ -174,7 +174,7 @@ and the `DOCKER_CERTS` to a directory containing files named `ca.pem`, You may build this into your own container with this example Dockerfile: ``` -FROM aacebedo/dnsdock +FROM p1c2u/dnsdock ENV DOCKER_TLS_VERIFY 1 ENV DOCKER_CERTS /certs @@ -314,8 +314,8 @@ Add the following snippet under the `units` part: [Service] EnvironmentFile=/etc/environment ExecStartPre=/bin/sh -c '/usr/bin/docker rm -f dnsdock || ls > /dev/null' - ExecStartPre=/bin/sh -c '/usr/bin/docker pull aacebedo/dnsdock' - ExecStart=/usr/bin/docker run -v /var/run/docker.sock:/var/run/docker.sock --name dnsdock -p ${COREOS_PRIVATE_IPV4}:53:53/udp aacebedo/dnsdock + ExecStartPre=/bin/sh -c '/usr/bin/docker pull p1c2u/dnsdock' + ExecStart=/usr/bin/docker run -v /var/run/docker.sock:/var/run/docker.sock --name dnsdock -p ${COREOS_PRIVATE_IPV4}:53:53/udp p1c2u/dnsdock ExecStop=/bin/sh -c '/usr/bin/docker stop dnsdock || ls > /dev/null' ``` diff --git a/src/core/cmdline.go b/src/core/cmdline.go index 0e2f634..10155a4 100644 --- a/src/core/cmdline.go +++ b/src/core/cmdline.go @@ -10,7 +10,7 @@ package core import ( "fmt" - "github.com/aacebedo/dnsdock/src/utils" + "github.com/p1c2u/dnsdock/src/utils" "gopkg.in/alecthomas/kingpin.v2" "strconv" ) diff --git a/src/core/docker.go b/src/core/docker.go index 10885b7..d45494e 100644 --- a/src/core/docker.go +++ b/src/core/docker.go @@ -11,8 +11,8 @@ package core import ( "crypto/tls" "errors" - "github.com/aacebedo/dnsdock/src/servers" - "github.com/aacebedo/dnsdock/src/utils" + "github.com/p1c2u/dnsdock/src/servers" + "github.com/p1c2u/dnsdock/src/utils" "github.com/docker/engine-api/client" "github.com/docker/engine-api/types" eventtypes "github.com/docker/engine-api/types/events" diff --git a/src/core/docker_test.go b/src/core/docker_test.go index f624b65..1a5e5b6 100644 --- a/src/core/docker_test.go +++ b/src/core/docker_test.go @@ -9,7 +9,7 @@ package core import ( - "github.com/aacebedo/dnsdock/src/servers" + "github.com/p1c2u/dnsdock/src/servers" "reflect" "testing" ) diff --git a/src/main.go b/src/main.go index 538d887..0f17448 100644 --- a/src/main.go +++ b/src/main.go @@ -11,9 +11,9 @@ package main import ( "crypto/tls" "crypto/x509" - "github.com/aacebedo/dnsdock/src/core" - "github.com/aacebedo/dnsdock/src/servers" - "github.com/aacebedo/dnsdock/src/utils" + "github.com/p1c2u/dnsdock/src/core" + "github.com/p1c2u/dnsdock/src/servers" + "github.com/p1c2u/dnsdock/src/utils" "github.com/op/go-logging" "io/ioutil" "os" diff --git a/src/servers/dnsserver.go b/src/servers/dnsserver.go index 03a0437..25c57a2 100644 --- a/src/servers/dnsserver.go +++ b/src/servers/dnsserver.go @@ -11,7 +11,7 @@ package servers import ( "errors" "fmt" - "github.com/aacebedo/dnsdock/src/utils" + "github.com/p1c2u/dnsdock/src/utils" "github.com/miekg/dns" "net" "regexp" diff --git a/src/servers/dnsserver_test.go b/src/servers/dnsserver_test.go index 2ec748a..42e39c4 100644 --- a/src/servers/dnsserver_test.go +++ b/src/servers/dnsserver_test.go @@ -9,7 +9,7 @@ package servers import ( - "github.com/aacebedo/dnsdock/src/utils" + "github.com/p1c2u/dnsdock/src/utils" "github.com/miekg/dns" "net" "strings" diff --git a/src/servers/http.go b/src/servers/http.go index 14ff203..bd2bc06 100644 --- a/src/servers/http.go +++ b/src/servers/http.go @@ -10,7 +10,7 @@ package servers import ( "encoding/json" - "github.com/aacebedo/dnsdock/src/utils" + "github.com/p1c2u/dnsdock/src/utils" "github.com/gorilla/mux" "net/http" ) diff --git a/src/servers/http_test.go b/src/servers/http_test.go index 97a44b3..470603e 100644 --- a/src/servers/http_test.go +++ b/src/servers/http_test.go @@ -9,7 +9,7 @@ package servers import ( - "github.com/aacebedo/dnsdock/src/utils" + "github.com/p1c2u/dnsdock/src/utils" "io/ioutil" "net/http" "strings"