From b38ba11b6bec92eca7d9921c0dab76893e07e315 Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Wed, 20 Feb 2019 09:02:54 +0100 Subject: [PATCH] refactored build process --- .drone.yml | 10 +++++++--- Dockerfile | 2 +- VERSION | 1 + build.sh | 3 ++- 4 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 VERSION diff --git a/.drone.yml b/.drone.yml index c7dbbb2..3ccff83 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,8 +3,12 @@ workspace: path: src/gitbase.de/apairon/mark2web pipeline: - build_mark2web: + build_mark2web_linux: image: golang:latest + environment: + - CGO_ENABLED=0 + - GOOS=linux + - GOARCH=amd64 commands: - ./build.sh @@ -12,8 +16,8 @@ pipeline: image: alpine commands: - ls -la - - ./mark2web -version - - ./mark2web -in website -out html -create -logLevel debug + - ./dist/mark2web-linux-amd64 -version + - ./dist/mark2web-linux-amd64 -in website -out html -create -logLevel debug build_docker: image: docker diff --git a/Dockerfile b/Dockerfile index b46853f..9c0edfd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ FROM alpine RUN apk update && apk add openssh-client sshpass rsync && rm -r /var/cache/ -ADD mark2web / +ADD dist/mark2web-linux-amd64 /mark2web CMD ["/mark2web"] diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..afaf360 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0.0 \ No newline at end of file diff --git a/build.sh b/build.sh index 0959387..f44d91b 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,4 @@ #!/bin/sh -CGO_ENABLED=0 go build -v -ldflags "-X main.Version=`git describe --tags --long` -X main.GitHash=`git rev-parse HEAD` -X main.BuildTime=`date -u '+%Y-%m-%d_%I:%M:%S%p'`" +mkdir -p dist +go build -v -ldflags "-X main.Version=`cat VERSION` -X main.GitHash=`git rev-parse HEAD` -X main.BuildTime=`date -u '+%Y-%m-%d_%I:%M:%S%p'`" -o dist/mark2web-${GOOS}-${GOARCH}${ext}