From 7c54f6c01562468943153e2a1295954da220137f Mon Sep 17 00:00:00 2001 From: Szepesi Tibor Date: Sun, 8 Dec 2024 03:48:17 +0100 Subject: [PATCH] Add RUST_VERSION argument to containerfiles (#108) --- Containerfile | 4 +- Makefile | 13 ------- containerfiles/migration.Containerfile | 4 +- containerfiles/setup.Containerfile | 4 +- justfile | 53 ++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 16 deletions(-) delete mode 100644 Makefile create mode 100644 justfile diff --git a/Containerfile b/Containerfile index 40be21d7..884f0e68 100644 --- a/Containerfile +++ b/Containerfile @@ -1,7 +1,9 @@ FROM registry.access.redhat.com/ubi9/ubi as chef +ARG RUST_VERSION + RUN curl --proto '=https' --tlsv1.3 -sSf https://sh.rustup.rs > rustup-init.sh && \ - sh rustup-init.sh --default-toolchain "1.79" --profile minimal -y && \ + sh rustup-init.sh --default-toolchain "$RUST_VERSION" --profile minimal -y && \ source "$HOME/.bashrc" && \ dnf install clang -y diff --git a/Makefile b/Makefile deleted file mode 100644 index 5735324d..00000000 --- a/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -all: - -.PHONY: build-images -build-images: - podman build -t ghcr.io/verseghy/matverseny-setup -f containerfiles/setup.Containerfile . - podman build -t ghcr.io/verseghy/matverseny-migration -f containerfiles/migration.Containerfile . - podman build -t ghcr.io/verseghy/matverseny-backend . - -.PHONY: push-images -push-images: - podman push ghcr.io/verseghy/matverseny-setup - podman push ghcr.io/verseghy/matverseny-migration - podman push ghcr.io/verseghy/matverseny-backend diff --git a/containerfiles/migration.Containerfile b/containerfiles/migration.Containerfile index a1803369..a0df2958 100644 --- a/containerfiles/migration.Containerfile +++ b/containerfiles/migration.Containerfile @@ -1,7 +1,9 @@ FROM registry.access.redhat.com/ubi9/ubi as chef +ARG RUST_VERSION + RUN curl --proto '=https' --tlsv1.3 -sSf https://sh.rustup.rs > rustup-init.sh && \ - sh rustup-init.sh --default-toolchain "1.79" --profile minimal -y && \ + sh rustup-init.sh --default-toolchain "$RUST_VERSION" --profile minimal -y && \ source "$HOME/.bashrc" && \ dnf install clang -y diff --git a/containerfiles/setup.Containerfile b/containerfiles/setup.Containerfile index 0552b45d..522380a9 100644 --- a/containerfiles/setup.Containerfile +++ b/containerfiles/setup.Containerfile @@ -1,7 +1,9 @@ FROM registry.access.redhat.com/ubi9/ubi as chef +ARG RUST_VERSION + RUN curl --proto '=https' --tlsv1.3 -sSf https://sh.rustup.rs > rustup-init.sh && \ - sh rustup-init.sh --default-toolchain "1.79" --profile minimal -y && \ + sh rustup-init.sh --default-toolchain "$RUST_VERSION" --profile minimal -y && \ source "$HOME/.bashrc" && \ dnf install clang -y diff --git a/justfile b/justfile new file mode 100644 index 00000000..f2bf7f00 --- /dev/null +++ b/justfile @@ -0,0 +1,53 @@ +#!/usr/bin/env -S just --justfile + +image_base := "ghcr.io/verseghy" +image_tag := "v7" +image_rust_version := "1.83" + +_default: + @just --list --unsorted + +install-tools: + cargo install cargo-deny --locked + cargo install cargo-llvm-cov --locked + +test-coverage: + @cargo llvm-cov --ignore-filename-regex "(migration|entity|cmds)/.*" nextest + +fmt: + cargo fmt --all + +clippy: + cargo clippy --all --all-targets --all-features + +[private] +build-image NAME FILE: + podman build \ + --file "{{FILE}}" \ + --tag {{image_base}}/{{NAME}}:{{image_tag}} \ + --build-arg RUST_VERSION="{{image_rust_version}}" \ + . + +[group("build")] +build-setup-image: (build-image "matverseny-setup" "containerfiles/setup.Containerfile") +[group("build")] +build-migration-image: (build-image "matverseny-migration" "containerfiles/migration.Containerfile") +[group("build")] +build-backend-image: (build-image "matverseny-backend" "Containerfile") + +[group("build")] +build-images: build-setup-image build-migration-image build-backend-image + +[private] +push-image NAME: + podman push {{image_base}}/{{NAME}}:{{image_tag}} + +[group("push")] +push-setup-image: (push-image "matverseny-setup") +[group("push")] +push-migration-image: (push-image "matverseny-migration") +[group("push")] +push-backend-image: (push-image "matverseny-backend") + +[group("push")] +push-images: push-setup-image push-migration-image push-backend-image