2024-03-25 21:02:52 +00:00
|
|
|
# .env file has the variables $DOCKER_USERNAME and $PASSWORD defined
|
|
|
|
include .env
|
2024-03-25 06:05:06 +00:00
|
|
|
|
2024-03-25 04:03:18 +00:00
|
|
|
setup:
|
|
|
|
cargo install cross
|
2024-03-25 21:02:52 +00:00
|
|
|
rustup target add x86_64-unknown-linux-musl
|
2024-03-25 04:27:31 +00:00
|
|
|
docker buildx create --use --platform=linux/arm64,linux/amd64 --name multi-platform-builder
|
|
|
|
docker buildx inspect --bootstrap
|
2024-03-25 04:03:18 +00:00
|
|
|
|
2024-03-25 21:02:52 +00:00
|
|
|
build-dev:
|
|
|
|
cargo build --release --locked --manifest-path=actix/Cargo.toml --target x86_64-unknown-linux-musl
|
|
|
|
|
|
|
|
docker-local: build-dev
|
|
|
|
docker build --tag chhoto-url --build-arg TARGETARCH=amd64 -f Dockerfile.multiarch .
|
|
|
|
|
|
|
|
docker-test: docker-local
|
|
|
|
docker ps -q --filter "name=chhoto-url" | xargs -r docker stop
|
|
|
|
docker ps -aq --filter "name=chhoto-url" | xargs -r docker rm
|
|
|
|
docker run -p 4567:4567 --name chhoto-url -e password="${PASSWORD}" -d chhoto-url
|
|
|
|
docker logs chhoto-url -f
|
|
|
|
|
|
|
|
docker-dev: build-dev
|
2024-03-25 21:08:04 +00:00
|
|
|
docker build --push --tag ${DOCKER_USERNAME}/chhoto-url:dev --build-arg TARGETARCH=amd64 -f Dockerfile.multiarch .
|
2024-03-25 21:02:52 +00:00
|
|
|
|
|
|
|
build-release:
|
2024-03-25 04:03:18 +00:00
|
|
|
cross build --release --locked --manifest-path=actix/Cargo.toml --target aarch64-unknown-linux-musl
|
2024-03-25 05:56:39 +00:00
|
|
|
cross build --release --locked --manifest-path=actix/Cargo.toml --target armv7-unknown-linux-musleabihf
|
2024-03-25 04:03:18 +00:00
|
|
|
cross build --release --locked --manifest-path=actix/Cargo.toml --target x86_64-unknown-linux-musl
|
|
|
|
|
2024-03-25 21:02:52 +00:00
|
|
|
V_PATCH := $(shell cat actix/Cargo.toml | sed -rn 's/^version = "(.+)"$$/\1/p')
|
|
|
|
V_MINOR := $(shell cat actix/Cargo.toml | sed -rn 's/^version = "(.+)\..+"$$/\1/p')
|
|
|
|
V_MAJOR := $(shell cat actix/Cargo.toml | sed -rn 's/^version = "(.+)\..+\..+"$$/\1/p')
|
|
|
|
docker-release: build-release
|
|
|
|
docker buildx build --push --tag ${DOCKER_USERNAME}/chhoto-url:${V_MAJOR} --tag ${DOCKER_USERNAME}/chhoto-url:${V_MINOR} --tag ${DOCKER_USERNAME}/chhoto-url:${V_PATCH} \
|
|
|
|
---tag ${DOCKER_USERNAME}/chhoto-url:latest -platform linux/amd64,linux/arm64,linux/arm/v7 -f Dockerfile.multiarch .
|
2024-03-25 04:03:18 +00:00
|
|
|
|
|
|
|
clean:
|
2024-03-25 21:44:47 +00:00
|
|
|
docker ps -q --filter "name=chhoto-url" | xargs -r docker stop
|
|
|
|
docker ps -aq --filter "name=chhoto-url" | xargs -r docker rm
|
2024-03-25 04:03:18 +00:00
|
|
|
cargo clean --manifest-path=actix/Cargo.toml
|
|
|
|
|
2024-03-25 21:02:52 +00:00
|
|
|
.PHONY: build-dev docker-local build-release
|