Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Merge pull request #60 from stefanprodan/release-1.0
Browse files Browse the repository at this point in the history
Release 1.0 (MongoDB 4.0 compatible)
  • Loading branch information
stefanprodan authored Feb 25, 2019
2 parents fff8a12 + b886aa0 commit b7df555
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 42 deletions.
19 changes: 15 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down Expand Up @@ -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"]

Expand Down
12 changes: 0 additions & 12 deletions Dockerfile.build

This file was deleted.

25 changes: 2 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 2 additions & 2 deletions backup/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -57,4 +57,4 @@ func CheckAzureClient() (string, error) {
}

return strings.Replace(string(output), "\n", " ", -1), nil
}
}

0 comments on commit b7df555

Please sign in to comment.