From ac462d5271da56db6b5c9f54c9f4e37abe00df5e Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Mon, 25 Feb 2019 16:36:12 +0200 Subject: [PATCH 1/3] Trim Azure CLI version --- backup/checks.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backup/checks.go b/backup/checks.go index 2fa50a2b..3efda933 100644 --- a/backup/checks.go +++ b/backup/checks.go @@ -47,7 +47,7 @@ func CheckGCloudClient() (string, error) { } func CheckAzureClient() (string, error) { - output, err := sh.Command("/bin/sh", "-c", "az --version").CombinedOutput() + output, err := sh.Command("/bin/sh", "-c", "az --version | grep 'azure-cli'").CombinedOutput() if err != nil { ex := "" if len(output) > 0 { @@ -57,4 +57,4 @@ func CheckAzureClient() (string, error) { } return strings.Replace(string(output), "\n", " ", -1), nil -} \ No newline at end of file +} From c89c579c66362774926ad6fe68a6716694c0538b Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Mon, 25 Feb 2019 16:37:55 +0200 Subject: [PATCH 2/3] Prepare 1.0 release - use Docker multi-stage build - update Mongo tools to 4.0.5 - update GCP CLI to 235.0.0 - update Azure CLI to 2.0.58 --- Dockerfile | 19 +++++++++++++++---- Dockerfile.build | 12 ------------ Makefile | 23 +---------------------- 3 files changed, 16 insertions(+), 38 deletions(-) delete mode 100644 Dockerfile.build diff --git a/Dockerfile b/Dockerfile index 997f0a34..dcb3e0ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,23 @@ +FROM golang:1.11 + +ARG APP_VERSION=unkown + +ADD . /go/src/github.com/stefanprodan/mgob + +WORKDIR /go/src/github.com/stefanprodan/mgob + +RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-X main.version=$APP_VERSION" \ + -a -installsuffix cgo -o mgob github.com/stefanprodan/mgob + FROM alpine:edge ARG BUILD_DATE ARG VCS_REF ARG VERSION -ENV MONGODB_TOOLS_VERSION 4.0.3-r0 -ENV GOOGLE_CLOUD_SDK_VERSION 181.0.0 -ENV AZURE_CLI_VERSION 2.0.44 +ENV MONGODB_TOOLS_VERSION 4.0.5-r0 +ENV GOOGLE_CLOUD_SDK_VERSION 235.0.0 +ENV AZURE_CLI_VERSION 2.0.58 ENV PATH /root/google-cloud-sdk/bin:$PATH LABEL org.label-schema.build-date=$BUILD_DATE \ @@ -52,7 +63,7 @@ RUN apk add py-pip && \ pip install azure-cli==${AZURE_CLI_VERSION} && \ apk del --purge build -COPY mgob . +COPY --from=0 /go/src/github.com/stefanprodan/mgob/mgob . VOLUME ["/config", "/storage", "/tmp", "/data"] diff --git a/Dockerfile.build b/Dockerfile.build deleted file mode 100644 index 1c8835ee..00000000 --- a/Dockerfile.build +++ /dev/null @@ -1,12 +0,0 @@ -FROM golang:1.8.3-alpine - -ARG APP_VERSION=unkown - -ADD . /go/src/github.com/stefanprodan/mgob - -WORKDIR /go/src/github.com/stefanprodan/mgob - -RUN mkdir -p /dist -RUN go build -ldflags "-X main.version=$APP_VERSION" -o /dist/mgob github.com/stefanprodan/mgob - -CMD ["ls"] \ No newline at end of file diff --git a/Makefile b/Makefile index 5ab3203b..143c72c9 100644 --- a/Makefile +++ b/Makefile @@ -15,19 +15,13 @@ PACKAGES:=$(shell go list ./... | grep -v '/vendor/') VETARGS:=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -rangeloops -shift -structtags -unsafeptr travis: - @echo ">>> Building mgob:build image" - @docker build --build-arg APP_VERSION=$(APP_VERSION).$(TRAVIS_BUILD_NUMBER) \ - -t $(REPOSITORY)/mgob:build -f Dockerfile.build . - @docker create --name mgob_extract $(REPOSITORY)/mgob:build - @docker cp mgob_extract:/dist/mgob ./mgob - @docker rm -f mgob_extract @echo ">>> Building mgob:$(APP_VERSION).$(TRAVIS_BUILD_NUMBER) image" @docker build \ --build-arg BUILD_DATE=$(BUILD_DATE) \ --build-arg VCS_REF=$(TRAVIS_COMMIT) \ --build-arg VERSION=$(APP_VERSION).$(TRAVIS_BUILD_NUMBER) \ -t $(REPOSITORY)/mgob:$(APP_VERSION).$(TRAVIS_BUILD_NUMBER) . - @rm ./mgob + @echo ">>> Starting mgob container" @docker run -d --net=host --name mgob \ --restart unless-stopped \ @@ -61,21 +55,6 @@ run: build -TmpPath=/tmp \ -LogLevel=info -build: clean - @echo ">>> Building mgob:build image" - @docker build --build-arg APP_VERSION=$(APP_VERSION) -t $(REPOSITORY)/mgob:build -f Dockerfile.build . - @docker create --name mgob_extract $(REPOSITORY)/mgob:build - @docker cp mgob_extract:/dist/mgob ./mgob - @docker rm -f mgob_extract - @echo ">>> Building mgob:$(APP_VERSION) image" - @docker build -t $(REPOSITORY)/mgob:$(APP_VERSION) . - @rm ./mgob - -clean: - @docker rm -f mgob-$(APP_VERSION) || true - @docker rmi $$(docker images | awk '$$1 ~ /mgob/ { print $$3 }') || true - @docker volume rm $$(docker volume ls -f dangling=true -q) || true - backend: @docker run -dp 20022:22 --name mgob-sftp \ atmoz/sftp:alpine test:test:::backup From b886aa09ca5b42f949faf908392bd7fcdfbd033a Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Mon, 25 Feb 2019 16:46:21 +0200 Subject: [PATCH 3/3] Bump version to 1.0 --- Makefile | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 143c72c9..877f22b4 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ SHELL:=/bin/bash -APP_VERSION?=0.10 +APP_VERSION?=1.0 # build vars BUILD_DATE:=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") diff --git a/README.md b/README.md index a71d41f2..8022e7c8 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Compatibility matrix: -----|-------- `stefanprodan/mgob:0.9` | 3.4 `stefanprodan/mgob:0.10` | 3.6 -`stefanprodan/mgob:edge` | 4.0 +`stefanprodan/mgob:1.0` | 4.0 Docker: