diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 4e2c2b52..0b955ea0 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -112,7 +112,7 @@ jobs: cd $SSH_PATH && \ git fetch origin --tags && \ git checkout "refs/tags/$VERSION" && \ - docker build -t factorion-bot:"$VERSION" . && \ + docker build -t factorion-bot:"$VERSION" --build-arg VERSION="$VERSION" . && \ docker stop factorion-bot || true && \ sleep 3 && \ docker rm factorion-bot || true && \ diff --git a/Cargo.lock b/Cargo.lock index f5fc24e7..8c428841 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -399,7 +399,7 @@ dependencies = [ [[package]] name = "factorion-bot-discord" -version = "2.1.11" +version = "2.1.12" dependencies = [ "anyhow", "dotenvy", @@ -414,7 +414,7 @@ dependencies = [ [[package]] name = "factorion-bot-reddit" -version = "5.2.11" +version = "5.2.12" dependencies = [ "anyhow", "base64 0.22.1", diff --git a/Dockerfile b/Dockerfile index cf305704..1e8499e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,15 @@ COPY . . RUN cd factorion-bot-reddit && cargo install --path . FROM debian:bookworm-slim +ARG VERSION=latest + +LABEL org.opencontainers.image.version="${VERSION}" +LABEL org.opencontainers.image.title="factorion-bot" +LABEL org.opencontainers.image.description="A Reddit bot that calculates factorials" +LABEL org.opencontainers.image.url="https://github.com/tolik518/factorion-bot" +LABEL org.opencontainers.image.source="https://github.com/tolik518/factorion-bot" +LABEL org.opencontainers.image.licenses="MIT" + RUN apt-get update && apt install -y openssl ca-certificates curl WORKDIR /usr/factorion COPY --from=builder /usr/local/cargo/bin/factorion-bot-reddit /usr/bin/factorion-bot diff --git a/factorion-bot-discord/Cargo.toml b/factorion-bot-discord/Cargo.toml index dda5e497..54c42d0a 100644 --- a/factorion-bot-discord/Cargo.toml +++ b/factorion-bot-discord/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "factorion-bot-discord" -version = "2.1.11" +version = "2.1.12" edition = "2024" description = "factorion-bot (for factorials and related) on Discord" license = "MIT" diff --git a/factorion-bot-discord/src/main.rs b/factorion-bot-discord/src/main.rs index 30c3c605..dcea3f11 100644 --- a/factorion-bot-discord/src/main.rs +++ b/factorion-bot-discord/src/main.rs @@ -50,7 +50,14 @@ fn init() { #[tokio::main] async fn main() -> Result<(), Box> { + let args = std::env::args().collect::>(); + if args.len() > 1 && (args[1] == "--version" || args[1] == "-v") { + println!("factorion-bot-discord v{}", env!("CARGO_PKG_VERSION")); + return Ok(()); + } + init(); + let consts = Consts { float_precision: std::env::var("FLOAT_PRECISION") .map(|s| s.parse().unwrap()) diff --git a/factorion-bot-reddit/Cargo.toml b/factorion-bot-reddit/Cargo.toml index a8a5e7cd..2f97f901 100644 --- a/factorion-bot-reddit/Cargo.toml +++ b/factorion-bot-reddit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "factorion-bot-reddit" -version = "5.2.11" +version = "5.2.12" edition = "2024" description = "factorion-bot (for factorials and related) on Reddit" license = "MIT" diff --git a/factorion-bot-reddit/src/main.rs b/factorion-bot-reddit/src/main.rs index 3d2db8ea..f3d8b5d6 100644 --- a/factorion-bot-reddit/src/main.rs +++ b/factorion-bot-reddit/src/main.rs @@ -60,6 +60,12 @@ impl Default for SubredditMode { #[tokio::main] async fn main() -> Result<(), Box> { + let args = std::env::args().collect::>(); + if args.len() > 1 && (args[1] == "--version" || args[1] == "-v") { + println!("factorion-bot-reddit v{}", env!("CARGO_PKG_VERSION")); + return Ok(()); + } + init(); let consts = Consts {