Skip to content

Commit

Permalink
Add RUST_VERSION argument to containerfiles (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
smrtrfszm authored Dec 8, 2024
1 parent 345b71b commit 7c54f6c
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 16 deletions.
4 changes: 3 additions & 1 deletion Containerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
13 changes: 0 additions & 13 deletions Makefile

This file was deleted.

4 changes: 3 additions & 1 deletion containerfiles/migration.Containerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 3 additions & 1 deletion containerfiles/setup.Containerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
53 changes: 53 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7c54f6c

Please sign in to comment.