From 6cce01390c5af5177d1af02136a5e10c8029bc0b Mon Sep 17 00:00:00 2001 From: Umputun Date: Sun, 10 Jun 2018 20:29:31 -0500 Subject: [PATCH] elimintate .git/objects from build context --- .dockerignore | 1 + Dockerfile | 2 +- app/main.go | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index 827ec1d2..dce3abb1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,6 +5,7 @@ /web/public/ /.vscode/ /.idea/ +/.git/objects/ # source files docker-compose.yml diff --git a/Dockerfile b/Dockerfile index fb2ef73a..1a665eba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,7 @@ RUN if [ -z "$COVERALLS_TOKEN" ] ; then \ else goveralls -coverprofile=.cover/cover.out -service=travis-ci -repotoken $COVERALLS_TOKEN; fi RUN \ - version=$(git rev-parse --abbrev-ref HEAD)-$(git describe --abbrev=7 --always --tags)-$(date +%Y%m%d-%H:%M:%S) && \ + version=$(/script/git-rev.sh) && \ echo "version $version" && \ go build -o remark -ldflags "-X main.revision=${version} -s -w" ./app diff --git a/app/main.go b/app/main.go index a807622b..86184ff8 100644 --- a/app/main.go +++ b/app/main.go @@ -85,8 +85,11 @@ func main() { if _, e := p.ParseArgs(os.Args[1:]); e != nil { os.Exit(1) } + + setupLog(opts.Dbg) log.Print("[INFO] started remark") resetEnv("SECRET", "AUTH_GOOGLE_CSEC", "AUTH_GITHUB_CSEC", "AUTH_FACEBOOK_CSEC", "AUTH_YANDEX_CSEC") + ctx, cancel := context.WithCancel(context.Background()) go func() { // catch signal and invoke graceful termination stop := make(chan os.Signal, 1) @@ -107,7 +110,6 @@ func main() { // New prepares application and return it with all active parts // doesn't start anything func New(opts Opts) (*Application, error) { - setupLog(opts.Dbg) if err := makeDirs(opts.BoltPath, opts.BackupLocation, opts.AvatarStore); err != nil { return nil, err