Fix core@ubuntu

This commit is contained in:
Jan Stabenow 2022-07-21 20:55:31 +02:00
parent 5482dbca06
commit 8dc8eb7918
No known key found for this signature in database
GPG key ID: 9C22DD65A9AAF133
4 changed files with 19 additions and 11 deletions

View file

@ -1,5 +1,5 @@
# CORE ALPINE BASE IMAGE # CORE ALPINE BASE IMAGE
OS_NAME=alpine OS_NAME=alpine
OS_VERSION=3.15 OS_VERSION=3.15
GOLANG_IMAGE=golang:1.18.2-alpine3.15 GOLANG_IMAGE=golang:1.18.4-alpine3.15
CORE_VERSION=16.8.0 CORE_VERSION=16.9.0

View file

@ -1,5 +1,5 @@
# CORE UBUNTU BASE IMAGE # CORE UBUNTU BASE IMAGE
OS_NAME=ubuntu OS_NAME=ubuntu
OS_VERSION=20.04 OS_VERSION=20.04
GOLANG_IMAGE=golang:1.18.2-alpine3.15 GOLANG_IMAGE=golang:1.18.4-alpine3.15
CORE_VERSION=16.8.0 CORE_VERSION=16.9.0

View file

@ -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 ARG BUILD_IMAGE=alpine:3.15
FROM $GOLANG_IMAGE as builder FROM $GOLANG_IMAGE as builder
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=""
COPY . /dist/core COPY . /dist/core
RUN apk add \ RUN apk add \
@ -15,8 +11,8 @@ RUN apk add \
make && \ make && \
cd /dist/core && \ cd /dist/core && \
go version && \ go version && \
make release && \ make release_linux && \
make import make import_linux
FROM $BUILD_IMAGE FROM $BUILD_IMAGE

View file

@ -10,6 +10,10 @@ all: build
build: build:
CGO_ENABLED=${CGO_ENABLED} GOOS=${GOOS} GOARCH=${GOARCH} go build -o core${BINSUFFIX} 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: Update swagger API documentation (requires github.com/swaggo/swag)
swagger: swagger:
swag init -g http/server.go swag init -g http/server.go
@ -56,6 +60,10 @@ lint:
import: import:
cd app/import && CGO_ENABLED=${CGO_ENABLED} GOOS=${GOOS} GOARCH=${GOARCH} go build -o ../../import -ldflags="-s -w" 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: Generate code coverage analysis
coverage: coverage:
go test -race -coverprofile test/cover.out ./... go test -race -coverprofile test/cover.out ./...
@ -69,6 +77,10 @@ commit: vet fmt lint test build
release: 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)" 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: Build standard Docker image
docker: docker:
docker build -t core:$(SHORTCOMMIT) . docker build -t core:$(SHORTCOMMIT) .