This repository has been archived on 2024-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
clear-docker-images/Makefile

40 lines
1.3 KiB
Makefile
Raw Normal View History

2022-02-17 22:28:56 +01:00
DOCKER_IMG := datahearth/clear-docker-images
GHCR_IMG := ghcr.io/${DOCKER_IMG}
2022-02-20 23:40:27 +01:00
VERSION := 0.4.1
2022-02-17 22:28:56 +01:00
2022-02-20 22:18:57 +01:00
.PHONY: initialize-linux-build
2022-02-17 22:28:56 +01:00
initialize-linux-build:
@brew install FiloSottile/musl-cross/musl-cross
@rustup target add x86_64-unknown-linux-musl
@echo 'add these lines to your "~/.cargo":'
@printf '\n[target.x86_64-unknown-linux-musl]\nlinker = "x86_64-linux-musl-gcc"\n'
2022-02-20 22:18:57 +01:00
.PHONY: build-docker
2022-02-17 22:28:56 +01:00
build-docker:
@docker build --tag ${DOCKER_IMG}:${VERSION} .
@docker tag ${DOCKER_IMG}:${VERSION} ${GHCR_IMG}:${VERSION}
@docker tag ${DOCKER_IMG}:${VERSION} ${DOCKER_IMG}:latest
2022-02-20 23:40:27 +01:00
@docker tag ${DOCKER_IMG}:${VERSION} ${GHCR_IMG}:latest
2022-02-17 22:28:56 +01:00
2022-02-20 22:18:57 +01:00
.PHONY: build-binaries
2022-02-17 22:28:56 +01:00
build-binaries:
@echo "Building Linux MUSL binary..."
@cargo build --release --target x86_64-unknown-linux-musl
@echo "Building MacOS darwin"
@cargo build --release --target x86_64-apple-darwin
2022-02-20 22:18:57 +01:00
.PHONY: push-docker-images
push-docker-images: build-docker
2022-02-17 22:28:56 +01:00
@docker push --all-tags ${GHCR_IMG}
2022-02-20 23:40:27 +01:00
@docker push --all-tags ${DOCKER_IMG}
.PHONY: bump-version
bump-version:
@echo "Bump version \"${VERSION}\" to \"${NEW_VERSION}\""
@sd "version = \"${VERSION}\"" "version = \"${NEW_VERSION}\"" Cargo.toml
@sd "VERSION := ${VERSION}" "VERSION := ${NEW_VERSION}" Makefile
@git add .
@git commit -m "bump v${NEW_VERSION}"
@git tag -m "bump v${NEW_VERSION}" v${NEW_VERSION}
@git push --follow-tags