Fix core@ubuntu

This commit is contained in:
Jan Stabenow
2022-07-21 20:55:31 +02:00
parent 5482dbca06
commit 8dc8eb7918
4 changed files with 19 additions and 11 deletions

View File

@@ -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

View File

@@ -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

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
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

View File

@@ -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) .