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..498b825 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,44 @@ +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/aacebedo/dnsdock + +WORKDIR /go/src/github.com/aacebedo/dnsdock + +RUN git clone https://github.com/aacebedo/dnsdock /go/src/github.com/aacebedo/dnsdock +# RUN git checkout {{$GIT_COMMIT}} + +RUN mkdir /tmp/output + +WORKDIR /go/src/github.com/aacebedo/dnsdock + +ENV GIT_SSL_NO_VERIFY=true + +RUN godep restore + +ENV GOARCH=amd64 + +WORKDIR /go/src/github.com/aacebedo/dnsdock/src + +RUN govvv build -o /tmp/output/dnsdock + +FROM alpine:3.18.2 + +ENV GOARCH=amd64 + +COPY --from=builder /tmp/output/dnsdock /bin/dnsdock + +ENTRYPOINT ["dnsdock"] \ No newline at end of file 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/src/core/docker.go b/src/core/docker.go index 10885b7..606e590 100644 --- a/src/core/docker.go +++ b/src/core/docker.go @@ -35,7 +35,7 @@ type DockerManager struct { // NewDockerManager creates a new DockerManager func NewDockerManager(c *utils.Config, list servers.ServiceListProvider, tlsConfig *tls.Config) (*DockerManager, error) { defaultHeaders := map[string]string{"User-Agent": "engine-api-cli-1.0"} - dclient, err := client.NewClient(c.DockerHost, "v1.22", nil, defaultHeaders) + dclient, err := client.NewClient(c.DockerHost, "v1.44", nil, defaultHeaders) if err != nil { return nil, err