diff --git a/.cargo/config-docker.toml b/.cargo/config-docker.toml
new file mode 100644
index 0000000..9eae839
--- /dev/null
+++ b/.cargo/config-docker.toml
@@ -0,0 +1,11 @@
+[net]
+git-fetch-with-cli = true
+
+[target.x86_64-unknown-linux-gnu]
+linker = "x86-64-linux-gnu-gcc"
+
+[target.aarch64-unknown-linux-gnu]
+linker = "aarch64-linux-gnu-gcc"
+
+[target.armv7-unknown-linux-gnueabihf]
+linker = "arm-linux-gnueabihf-gcc"
\ No newline at end of file
diff --git a/.dockerignore b/.dockerignore
deleted file mode 120000
index 3e4e48b..0000000
--- a/.dockerignore
+++ /dev/null
@@ -1 +0,0 @@
-.gitignore
\ No newline at end of file
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..0845f83
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,18 @@
+/.devcontainer/
+/.github/
+/.idea/
+/.vscode/
+/benches/
+/examples/
+/media/
+/target/
+/tests/
+/.dockerignore
+/.gitignore
+/Dockerfile
+/icon.png
+/LICENSE
+/README.md
+/riot.txt
+/rustfmt.toml
+**/*.rs.bk
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..c8ab97f
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,11 @@
+name: "Release new version"
+
+on:
+ # Creation of a new tag starting with v
+ push:
+ tags:
+ - "v*"
+
+jobs:
+ ghcrio:
+ uses: Steffo99/.github/.github/workflows/buildrelease-docker.yml@main
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index 33d1c07..7e2331d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -194,22 +194,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
-[[package]]
-name = "core-foundation"
-version = "0.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
-name = "core-foundation-sys"
-version = "0.8.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
-
[[package]]
name = "cpufeatures"
version = "0.2.5"
@@ -474,21 +458,6 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
-[[package]]
-name = "foreign-types"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
-dependencies = [
- "foreign-types-shared",
-]
-
-[[package]]
-name = "foreign-types-shared"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
-
[[package]]
name = "form_urlencoded"
version = "1.1.0"
@@ -769,19 +738,6 @@ dependencies = [
"tokio-rustls",
]
-[[package]]
-name = "hyper-tls"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
-dependencies = [
- "bytes",
- "hyper",
- "native-tls",
- "tokio",
- "tokio-native-tls",
-]
-
[[package]]
name = "ident_case"
version = "1.0.1"
@@ -1020,24 +976,6 @@ dependencies = [
"byteorder",
]
-[[package]]
-name = "native-tls"
-version = "0.2.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
-dependencies = [
- "lazy_static",
- "libc",
- "log",
- "openssl",
- "openssl-probe",
- "openssl-sys",
- "schannel",
- "security-framework",
- "security-framework-sys",
- "tempfile",
-]
-
[[package]]
name = "never"
version = "0.1.0"
@@ -1098,51 +1036,6 @@ dependencies = [
"loom",
]
-[[package]]
-name = "openssl"
-version = "0.10.45"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1"
-dependencies = [
- "bitflags",
- "cfg-if",
- "foreign-types",
- "libc",
- "once_cell",
- "openssl-macros",
- "openssl-sys",
-]
-
-[[package]]
-name = "openssl-macros"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "openssl-probe"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
-
-[[package]]
-name = "openssl-sys"
-version = "0.9.80"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7"
-dependencies = [
- "autocfg",
- "cc",
- "libc",
- "pkg-config",
- "vcpkg",
-]
-
[[package]]
name = "ordered-float"
version = "2.10.0"
@@ -1192,7 +1085,7 @@ dependencies = [
[[package]]
name = "patched_porobot"
-version = "0.9.0"
+version = "0.9.2"
dependencies = [
"anyhow",
"data-encoding",
@@ -1252,12 +1145,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
-[[package]]
-name = "pkg-config"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
-
[[package]]
name = "ppv-lite86"
version = "0.2.17"
@@ -1443,13 +1330,11 @@ dependencies = [
"http-body",
"hyper",
"hyper-rustls",
- "hyper-tls",
"ipnet",
"js-sys",
"log",
"mime",
"mime_guess",
- "native-tls",
"once_cell",
"percent-encoding",
"pin-project-lite",
@@ -1459,7 +1344,6 @@ dependencies = [
"serde_json",
"serde_urlencoded",
"tokio",
- "tokio-native-tls",
"tokio-rustls",
"tokio-util",
"tower-service",
@@ -1545,15 +1429,6 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
-[[package]]
-name = "schannel"
-version = "0.1.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3"
-dependencies = [
- "windows-sys 0.42.0",
-]
-
[[package]]
name = "scoped-tls"
version = "1.0.1"
@@ -1576,29 +1451,6 @@ dependencies = [
"untrusted",
]
-[[package]]
-name = "security-framework"
-version = "2.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254"
-dependencies = [
- "bitflags",
- "core-foundation",
- "core-foundation-sys",
- "libc",
- "security-framework-sys",
-]
-
-[[package]]
-name = "security-framework-sys"
-version = "2.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
[[package]]
name = "semver"
version = "1.0.16"
@@ -2065,16 +1917,6 @@ dependencies = [
"syn",
]
-[[package]]
-name = "tokio-native-tls"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"
-dependencies = [
- "native-tls",
- "tokio",
-]
-
[[package]]
name = "tokio-rustls"
version = "0.23.4"
@@ -2301,12 +2143,6 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f54a172d0620933a27a4360d3db3e2ae0dd6cceae9730751a036bbf182c4b23"
-[[package]]
-name = "vcpkg"
-version = "0.2.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
-
[[package]]
name = "version_check"
version = "0.9.4"
diff --git a/Cargo.toml b/Cargo.toml
index 93cf1a3..cc674fc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "patched_porobot"
-version = "0.9.1"
+version = "0.9.2"
authors = ["Stefano Pigozzi "]
edition = "2021"
description = "Legends of Runeterra card database utilities and bots"
@@ -9,6 +9,7 @@ license = "AGPL-3.0-or-later"
keywords = ["game", "deserialization", "legends-of-runeterra", "bot", "search"]
categories = ["games", "parser-implementations"]
+
[package.metadata.docs.rs]
all-features = true
cargo-args = ["--bins"]
@@ -32,8 +33,8 @@ serde_json = { version = "1.0.82" }
# search
tantivy = { version = "0.19.1", optional = true }
# telegram
-teloxide = { version = "0.12.0", optional = true }
-reqwest = { version = "0.11.11", optional = true }
+teloxide = { version = "0.12.0", features = ["rustls", "ctrlc_handler", "auto-send"], default-features = false, optional = true }
+reqwest = { version = "0.11.11", features = ["rustls-tls"], default-features = false, optional = true }
tokio = { version = "1.20.3", features = ["rt-multi-thread", "macros"], optional = true }
md5 = { version = "0.7.0", optional = true }
rand = { version = "0.8.5", optional = true }
@@ -44,7 +45,6 @@ anyhow = { version = "^1.0.68", optional = true }
[features]
-# data = [] # Always included
exec = ["pretty_env_logger"]
search = ["tantivy"]
telegram = ["exec", "search", "teloxide", "reqwest", "tokio", "md5", "rand"]
diff --git a/Dockerfile b/Dockerfile
index e9ad475..c699bc6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,18 +1,44 @@
-FROM rust:1.64-buster AS files
-WORKDIR /usr/src/patched_porobot
-COPY . .
+FROM --platform=${BUILDPLATFORM} rust:1.68-bullseye AS builder
+ARG TARGETPLATFORM
+ARG RUSTTARGET
-FROM files AS system
-RUN apt-get install -y libssl1.1
+RUN apt-get update && \
+ apt-get upgrade --assume-yes
-FROM system AS build
-RUN cargo install --path . --all-features --bins
+RUN \
+ if [ ${TARGETPLATFORM} = "linux/amd64" ]; then \
+ apt-get install --assume-yes gcc-x86-64-linux-gnu; \
+ fi && \
+ if [ ${TARGETPLATFORM} = "linux/arm64" ]; then \
+ apt-get install --assume-yes gcc-aarch64-linux-gnu; \
+ fi && \
+ if [ ${TARGETPLATFORM} = "linux/arm/v7" ]; then \
+ apt-get install --assume-yes gcc-arm-linux-gnueabihf; \
+ fi
+
+RUN rustup target add ${RUSTTARGET}
+
+WORKDIR /usr/src/patched_porobot/
+COPY ./ ./
+RUN mv ./.cargo/config-docker.toml ./.cargo/config.toml
+
+RUN cargo build --all-features --bins --release --target=${RUSTTARGET}
+
+#############################################################################
+
+FROM --platform=${TARGETPLATFORM} rust:1.68-slim-bullseye AS final
+ARG RUSTTARGET
+
+WORKDIR /usr/src/patched_porobot/
+COPY --from=builder \
+ /usr/src/patched_porobot/target/${RUSTTARGET}/release/patched_porobot_discord \
+ /usr/src/patched_porobot/target/${RUSTTARGET}/release/patched_porobot_telegram \
+ /usr/src/patched_porobot/target/${RUSTTARGET}/release/patched_porobot_matrix \
+ /usr/bin/
-FROM build AS entrypoint
ENTRYPOINT []
CMD []
-FROM entrypoint AS final
LABEL org.opencontainers.image.title="Patched Porobot"
LABEL org.opencontainers.image.description="Legends of Runeterra card database utilities and bots"
LABEL org.opencontainers.image.licenses="AGPL-3.0-or-later"