generate outside of docker

This commit is contained in:
Kwitsch 2022-09-14 15:08:21 +02:00
parent 0136755f4a
commit 9cbff3d180
3 changed files with 11 additions and 3 deletions

View File

@ -58,6 +58,15 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Go Generate
shell: bash
run: go generate ./...
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@ -36,15 +36,13 @@ RUN --mount=type=cache,target=/root/go/pkg,sharing=locked \
# add source
ADD . .
RUN go generate ./...
# setup environment
ENV GO111MODULE=on
ENV CGO_ENABLED=0
# build binary
RUN --mount=type=cache,target=/root/.cache/go-build,sharing=locked \
go build \
RUN go build \
-tags static \
-v \
-ldflags="-linkmode external -extldflags -static -X github.com/0xERR0R/blocky/util.Version=${VERSION} -X github.com/0xERR0R/blocky/util.BuildTime=${BUILD_TIME}" \

View File

@ -49,6 +49,7 @@ fmt: ## gofmt and goimports all go files
find . -name '*.go' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
docker-build: ## Build docker image
go generate ./...
docker buildx build -o type=docker --build-arg VERSION=${VERSION} --build-arg BUILD_TIME=${BUILD_TIME} --network=host -t ${DOCKER_IMAGE_NAME} .
help: ## Shows help