From 8dc8eb7918140590bdab0dd3f378da1d99981fb8 Mon Sep 17 00:00:00 2001 From: Jan Stabenow Date: Thu, 21 Jul 2022 20:55:31 +0200 Subject: [PATCH] Fix core@ubuntu --- .github_build/Build.alpine.env | 4 ++-- .github_build/Build.ubuntu.env | 4 ++-- Dockerfile | 10 +++------- Makefile | 12 ++++++++++++ 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.github_build/Build.alpine.env b/.github_build/Build.alpine.env index a89047b8..34495bfe 100644 --- a/.github_build/Build.alpine.env +++ b/.github_build/Build.alpine.env @@ -1,5 +1,5 @@ # CORE ALPINE BASE IMAGE OS_NAME=alpine OS_VERSION=3.15 -GOLANG_IMAGE=golang:1.18.2-alpine3.15 -CORE_VERSION=16.8.0 +GOLANG_IMAGE=golang:1.18.4-alpine3.15 +CORE_VERSION=16.9.0 diff --git a/.github_build/Build.ubuntu.env b/.github_build/Build.ubuntu.env index f39d63bd..3d341c47 100644 --- a/.github_build/Build.ubuntu.env +++ b/.github_build/Build.ubuntu.env @@ -1,5 +1,5 @@ # CORE UBUNTU BASE IMAGE OS_NAME=ubuntu OS_VERSION=20.04 -GOLANG_IMAGE=golang:1.18.2-alpine3.15 -CORE_VERSION=16.8.0 +GOLANG_IMAGE=golang:1.18.4-alpine3.15 +CORE_VERSION=16.9.0 diff --git a/Dockerfile b/Dockerfile index 37da7f96..50378cb0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,9 @@ -ARG GOLANG_IMAGE=golang:1.17.6-alpine3.15 +ARG GOLANG_IMAGE=golang:1.18.4-alpine3.15 ARG BUILD_IMAGE=alpine:3.15 FROM $GOLANG_IMAGE as builder -ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH="" - COPY . /dist/core RUN apk add \ @@ -15,8 +11,8 @@ RUN apk add \ make && \ cd /dist/core && \ go version && \ - make release && \ - make import + make release_linux && \ + make import_linux FROM $BUILD_IMAGE diff --git a/Makefile b/Makefile index 25dbf8b9..e7de5b64 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,10 @@ all: build build: CGO_ENABLED=${CGO_ENABLED} GOOS=${GOOS} GOARCH=${GOARCH} go build -o core${BINSUFFIX} +# github workflow workaround +build_linux: + CGO_ENABLED=0 GOOS=linux GOARCH=${OSARCH} go build -o core + ## swagger: Update swagger API documentation (requires github.com/swaggo/swag) swagger: swag init -g http/server.go @@ -56,6 +60,10 @@ lint: import: cd app/import && CGO_ENABLED=${CGO_ENABLED} GOOS=${GOOS} GOARCH=${GOARCH} go build -o ../../import -ldflags="-s -w" +# github workflow workaround +import_linux: + cd app/import && CGO_ENABLED=0 GOOS=linux GOARCH=${OSARCH} go build -o ../../import -ldflags="-s -w" + ## coverage: Generate code coverage analysis coverage: go test -race -coverprofile test/cover.out ./... @@ -69,6 +77,10 @@ commit: vet fmt lint test build release: CGO_ENABLED=${CGO_ENABLED} GOOS=${GOOS} GOARCH=${GOARCH} go build -o core -ldflags="-s -w -X github.com/datarhei/core/app.Commit=$(COMMIT) -X github.com/datarhei/core/app.Branch=$(BRANCH) -X github.com/datarhei/core/app.Build=$(BUILD)" +# github workflow workaround +release_linux: + CGO_ENABLED=0 GOOS=linux GOARCH=${OSARCH} go build -o core -ldflags="-s -w -X github.com/datarhei/core/app.Commit=$(COMMIT) -X github.com/datarhei/core/app.Branch=$(BRANCH) -X github.com/datarhei/core/app.Build=$(BUILD)" + ## docker: Build standard Docker image docker: docker build -t core:$(SHORTCOMMIT) .