dockron/Makefile
Ian Fijolek 7c6e536ec3
All checks were successful
continuous-integration/drone/push Build is passing
Try out multi arch builds
2019-06-07 15:40:04 -07:00

63 lines
1.5 KiB
Makefile

DOCKER_TAG ?= dockron-dev-${USER}
.PHONY: default
default: build
# Downloads dependencies into vendor directory
vendor:
dep ensure
# Runs the application, useful while developing
.PHONY: run
run: vendor
go run *.go
# Output target
dockron: vendor
go build -o dockron
# Alias for building
.PHONY: build
build: dockron
# Cleans all build artifacts
.PHONY: clean
clean:
rm dockron
# Cleans vendor directory
.PHONY: clean-vendor
clean-vendor:
rm -fr ./vendor
# Attempts to update dependencies
.PHONY: dep-update
dep-update:
dep ensure -update
.PHONY: docker-build
docker-build:
docker build . -t ${DOCKER_TAG}-linux-amd64
# Cross build for arm architechtures
.PHONY: docker-cross-build-arm
docker-cross-build-arm:
docker build --build-arg REPO=arm32v6 --build-arg ARCH=arm . -t ${DOCKER_TAG}-linux-arm
.PHONY: docker-cross-build-arm
docker-cross-build-arm64:
docker build --build-arg REPO=arm64v8 --build-arg ARCH=arm64 . -t ${DOCKER_TAG}-linux-arm64
.PHONY: docker-run
docker-run: docker-build
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --name $(DOCKER_TAG)-run $(DOCKER_TAG)-linux-amd64
# Cross run on host architechture
.PHONY: docker-cross-run-arm
docker-cross-run-arm: docker-cross-build-arm
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --name $(DOCKER_TAG)-run ${DOCKER_TAG}-linux-arm
.PHONY: docker-cross-run-arm64
docker-cross-run-arm64: docker-cross-build-arm64
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --name $(DOCKER_TAG)-run ${DOCKER_TAG}-linux-arm64