build: Switched the testing to podman

This commit is contained in:
SinTan1729
2025-10-10 19:20:46 -05:00
parent 5b60d25e64
commit a7f30a0be2

View File

@@ -1,26 +1,26 @@
# SPDX-FileCopyrightText: 2023 Sayantan Santra <sayantan.santra689@gmail.com>
# SPDX-License-Identifier: MIT
# .env file has the variables $DOCKER_USERNAME and $PASSWORD defined
# .env file has the variables $podman_USERNAME and $PASSWORD defined
include .env
.PHONY: clean test setup build-dev docker-local docker-stop docker-test build-release docker-release tag audit
.PHONY: clean test setup build-dev podman-local podman-stop podman-test build-release tag audit
setup:
# cargo install cross
rustup target add x86_64-unknown-linux-musl
# docker buildx create --use --platform=linux/arm64,linux/amd64,linux/arm/v7 --name multi-platform-builder
docker buildx inspect --bootstrap
# podman buildx create --use --platform=linux/arm64,linux/amd64,linux/arm/v7 --name multi-platform-builder
podman buildx inspect --bootstrap
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.alpine .
podman-local: build-dev
podman build --tag chhoto-url --build-arg TARGETARCH=amd64 -f Dockerfile.alpine .
docker-stop:
docker ps -q --filter "name=chhoto-url" | xargs -r docker stop
docker ps -aq --filter "name=chhoto-url" | xargs -r docker rm
podman-stop:
podman ps -q --filter "name=chhoto-url" | xargs -r podman stop
podman ps -aq --filter "name=chhoto-url" | xargs -r podman rm
test: audit
cargo test --release --locked --manifest-path=actix/Cargo.toml --target x86_64-unknown-linux-musl
@@ -28,12 +28,12 @@ test: audit
audit:
cargo audit --file actix/Cargo.lock
docker-test: docker-local docker-stop test
docker run -t -p ${port}:${port} --name chhoto-url --env-file ./.env -v "${db_dir}:/data" -d chhoto-url
docker logs chhoto-url -f
podman-test: podman-local podman-stop test
podman run -t -p ${port}:${port} --name chhoto-url --env-file ./.env -v "${db_dir}:/data" -d chhoto-url
podman logs chhoto-url -f
docker-dev: test build-dev
docker build --push --tag ghcr.io/${github_username}/chhoto-url:dev --build-arg TARGETARCH=amd64 -f Dockerfile.alpine .
# podman-dev: test build-dev
# podman build --push --tag ghcr.io/${github_username}/chhoto-url:dev --build-arg TARGETARCH=amd64 -f Dockerfile.alpine .
# build-release: test
# cross build --release --locked --manifest-path=actix/Cargo.toml --target aarch64-unknown-linux-musl
@@ -59,18 +59,18 @@ endif
# 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: tag build-release
# podman-release: tag build-release
# minify -rsi resources/
# 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 \
# podman buildx build --push --tag ${podman_username}/chhoto-url:${v_major} --tag ${podman_username}/chhoto-url:${v_minor} \
# --tag ${podman_username}/chhoto-url:${v_patch} --tag ${podman_username}/chhoto-url:latest \
# --platform linux/amd64,linux/arm64,linux/arm/v7 -f Dockerfile.alpine .
# docker buildx build --push --tag ghcr.io/${github_username}/chhoto-url:${v_major} --tag ghcr.io/${github_username}/chhoto-url:${v_minor} \
# podman buildx build --push --tag ghcr.io/${github_username}/chhoto-url:${v_major} --tag ghcr.io/${github_username}/chhoto-url:${v_minor} \
# --tag ghcr.io/${github_username}/chhoto-url:${v_patch} --tag ghcr.io/${github_username}/chhoto-url:latest \
# --platform linux/amd64,linux/arm64,linux/arm/v7 -f Dockerfile.scratch .
# git restore resources/
clean:
docker ps -q --filter "name=chhoto-url" | xargs -r docker stop
docker ps -aq --filter "name=chhoto-url" | xargs -r docker rm
podman ps -q --filter "name=chhoto-url" | xargs -r podman stop
podman ps -aq --filter "name=chhoto-url" | xargs -r podman rm
cargo clean --manifest-path=actix/Cargo.toml