cleanup makefile (#45)

This commit is contained in:
Robert Kaussow 2022-04-25 12:48:52 +02:00 committed by GitHub
parent ecfb0daa85
commit 4b1e479d93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 78 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
*
!dist/

View File

@ -1,6 +1,5 @@
local PipelineTest = {
kind: 'pipeline',
image_pull_secrets: ['docker_config'],
name: 'test',
platform: {
os: 'linux',
@ -61,7 +60,6 @@ local PipelineTest = {
local PipelineBuildBinaries = {
kind: 'pipeline',
image_pull_secrets: ['docker_config'],
name: 'build-binaries',
platform: {
os: 'linux',
@ -79,7 +77,7 @@ local PipelineBuildBinaries = {
name: 'executable',
image: 'alpine',
commands: [
'$(find dist/ -executable -type f | grep drone-docker-linux-amd64) --help',
'$(find dist/ -executable -type f -iname ${DRONE_REPO_NAME}-linux-amd64) --help',
],
},
{
@ -127,7 +125,6 @@ local PipelineBuildBinaries = {
local PipelineBuildContainer(arch='amd64') = {
kind: 'pipeline',
image_pull_secrets: ['docker_config'],
name: 'build-container-' + arch,
platform: {
os: 'linux',
@ -143,14 +140,11 @@ local PipelineBuildContainer(arch='amd64') = {
},
{
name: 'dryrun',
image: 'plugins/docker:19',
image: 'thegeeklab/drone-docker:19',
settings: {
config: { from_secret: 'docker_config' },
dry_run: true,
dockerfile: 'docker/Dockerfile.' + arch,
repo: 'thegeeklab/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
depends_on: ['build'],
when: {
@ -159,9 +153,8 @@ local PipelineBuildContainer(arch='amd64') = {
},
{
name: 'publish-dockerhub',
image: 'plugins/docker:19',
image: 'thegeeklab/drone-docker:19',
settings: {
config: { from_secret: 'docker_config' },
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: 'docker/Dockerfile.' + arch,
@ -176,9 +169,8 @@ local PipelineBuildContainer(arch='amd64') = {
},
{
name: 'publish-quay',
image: 'plugins/docker:19',
image: 'thegeeklab/drone-docker:19',
settings: {
config: { from_secret: 'docker_config' },
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: 'docker/Dockerfile.' + arch,
@ -258,7 +250,6 @@ local PipelineDocs = {
local PipelineNotifications = {
kind: 'pipeline',
image_pull_secrets: ['docker_config'],
name: 'notifications',
platform: {
os: 'linux',

View File

@ -35,9 +35,6 @@ volumes:
- name: godeps
temp: {}
image_pull_secrets:
- docker_config
trigger:
ref:
- refs/heads/main
@ -61,7 +58,7 @@ steps:
- name: executable
image: alpine
commands:
- $(find dist/ -executable -type f | grep drone-docker-linux-amd64) --help
- $(find dist/ -executable -type f -iname ${DRONE_REPO_NAME}-linux-amd64) --help
- name: changelog-generate
image: thegeeklab/git-chglog
@ -89,9 +86,6 @@ steps:
ref:
- refs/tags/**
image_pull_secrets:
- docker_config
trigger:
ref:
- refs/heads/main
@ -116,17 +110,11 @@ steps:
- make build
- name: dryrun
image: plugins/docker:19
image: thegeeklab/drone-docker:19
settings:
config:
from_secret: docker_config
dockerfile: docker/Dockerfile.amd64
dry_run: true
password:
from_secret: docker_password
repo: thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/pull/**
@ -134,12 +122,10 @@ steps:
- build
- name: publish-dockerhub
image: plugins/docker:19
image: thegeeklab/drone-docker:19
settings:
auto_tag: true
auto_tag_suffix: amd64
config:
from_secret: docker_config
dockerfile: docker/Dockerfile.amd64
password:
from_secret: docker_password
@ -154,12 +140,10 @@ steps:
- dryrun
- name: publish-quay
image: plugins/docker:19
image: thegeeklab/drone-docker:19
settings:
auto_tag: true
auto_tag_suffix: amd64
config:
from_secret: docker_config
dockerfile: docker/Dockerfile.amd64
password:
from_secret: quay_password
@ -174,9 +158,6 @@ steps:
depends_on:
- dryrun
image_pull_secrets:
- docker_config
trigger:
ref:
- refs/heads/main
@ -201,17 +182,11 @@ steps:
- make build
- name: dryrun
image: plugins/docker:19
image: thegeeklab/drone-docker:19
settings:
config:
from_secret: docker_config
dockerfile: docker/Dockerfile.arm64
dry_run: true
password:
from_secret: docker_password
repo: thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/pull/**
@ -219,12 +194,10 @@ steps:
- build
- name: publish-dockerhub
image: plugins/docker:19
image: thegeeklab/drone-docker:19
settings:
auto_tag: true
auto_tag_suffix: arm64
config:
from_secret: docker_config
dockerfile: docker/Dockerfile.arm64
password:
from_secret: docker_password
@ -239,12 +212,10 @@ steps:
- dryrun
- name: publish-quay
image: plugins/docker:19
image: thegeeklab/drone-docker:19
settings:
auto_tag: true
auto_tag_suffix: arm64
config:
from_secret: docker_config
dockerfile: docker/Dockerfile.arm64
password:
from_secret: quay_password
@ -259,9 +230,6 @@ steps:
depends_on:
- dryrun
image_pull_secrets:
- docker_config
trigger:
ref:
- refs/heads/main
@ -286,17 +254,11 @@ steps:
- make build
- name: dryrun
image: plugins/docker:19
image: thegeeklab/drone-docker:19
settings:
config:
from_secret: docker_config
dockerfile: docker/Dockerfile.arm
dry_run: true
password:
from_secret: docker_password
repo: thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/pull/**
@ -304,12 +266,10 @@ steps:
- build
- name: publish-dockerhub
image: plugins/docker:19
image: thegeeklab/drone-docker:19
settings:
auto_tag: true
auto_tag_suffix: arm
config:
from_secret: docker_config
dockerfile: docker/Dockerfile.arm
password:
from_secret: docker_password
@ -324,12 +284,10 @@ steps:
- dryrun
- name: publish-quay
image: plugins/docker:19
image: thegeeklab/drone-docker:19
settings:
auto_tag: true
auto_tag_suffix: arm
config:
from_secret: docker_config
dockerfile: docker/Dockerfile.arm
password:
from_secret: quay_password
@ -344,9 +302,6 @@ steps:
depends_on:
- dryrun
image_pull_secrets:
- docker_config
trigger:
ref:
- refs/heads/main
@ -486,9 +441,6 @@ steps:
- success
- failure
image_pull_secrets:
- docker_config
trigger:
ref:
- refs/heads/main
@ -502,6 +454,6 @@ depends_on:
---
kind: signature
hmac: 9ee9ec07028e26d74e30bb239266b01dd105621178225d50bf2a214712d816e9
hmac: 9272f58ad1c23c3d09fe6d4c61d4f6343c9fc70229826a55c45179182b6e5f49
...

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
/dist/
/release/
/drone-docker*
coverage.out

View File

@ -43,7 +43,7 @@ all: clean build
.PHONY: clean
clean:
go clean -i ./...
$(GO) clean -i ./...
rm -rf $(DIST_DIRS)
.PHONY: fmt
@ -59,24 +59,24 @@ lint: golangci-lint
.PHONY: generate
generate:
go generate $(GENERATE)
$(GO) generate $(GENERATE)
.PHONY: test
test:
go test -v -coverprofile coverage.out $(PACKAGES)
$(GO) test -v -coverprofile coverage.out $(PACKAGES)
.PHONY: build
build: $(DIST)/$(EXECUTABLE)
$(DIST)/$(EXECUTABLE): $(SOURCES)
go build -v -tags '$(TAGS)' -ldflags '-extldflags "-static" $(LDFLAGS)' -o $@ ./cmd/$(EXECUTABLE)
$(GO) build -v -tags '$(TAGS)' -ldflags '-extldflags "-static" $(LDFLAGS)' -o $@ ./cmd/$(EXECUTABLE)
$(DIST_DIRS):
mkdir -p $(DIST_DIRS)
.PHONY: xgo
xgo: | $(DIST_DIRS)
go run $(XGO_PACKAGE) -go $(XGO_VERSION) -v -ldflags '-extldflags "-static" $(LDFLAGS)' -tags '$(TAGS)' -targets '$(XGO_TARGETS)' -out $(EXECUTABLE) --pkg cmd/$(EXECUTABLE) .
$(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -v -ldflags '-extldflags "-static" $(LDFLAGS)' -tags '$(TAGS)' -targets '$(XGO_TARGETS)' -out $(EXECUTABLE) --pkg cmd/$(EXECUTABLE) .
cp /build/* $(CWD)/$(DIST)
ls -l $(CWD)/$(DIST)

View File

@ -31,7 +31,7 @@ export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on
go build -v -a -tags netgo -o release/amd64/drone-docker ./cmd/drone-docker/
make build
```
Build the Docker image with the following command: