Implement cargo-chef
Some checks failed
Build and push container image / build (push) Failing after 11m22s

This commit is contained in:
toast 2024-05-03 05:26:05 +10:00
parent b9dbe2657c
commit d28d0c2bf5
4 changed files with 55 additions and 46 deletions

View File

@ -38,10 +38,11 @@ jobs:
platforms: linux/amd64 platforms: linux/amd64
push: true push: true
tags: git.toast-server.net/toast/kon:main tags: git.toast-server.net/toast/kon:main
build-args: | build-args: CARGO_TOKEN=${{ secrets.CARGO_TOKEN }}
CARGO_TOKEN=${{ secrets.CARGO_TOKEN }} cache-from: type=registry,ref=git.toast-server.net/toast/kon:cache
cache-to: type=registry,ref=git.toast-server.net/toast/kon:cache,mode=max
- name: Update Delivery - name: Deploy update
uses: https://github.com/appleboy/ssh-action@029f5b4aeeeb58fdfe1410a5d17f967dacf36262 # v1.0.3 uses: https://github.com/appleboy/ssh-action@029f5b4aeeeb58fdfe1410a5d17f967dacf36262 # v1.0.3
with: with:
host: ${{ secrets.SSH_HOST }} host: ${{ secrets.SSH_HOST }}

64
Cargo.lock generated
View File

@ -90,9 +90,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.22.0" version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
@ -192,9 +192,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.95" version = "1.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -344,9 +344,9 @@ dependencies = [
[[package]] [[package]]
name = "data-encoding" name = "data-encoding"
version = "2.5.0" version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2"
[[package]] [[package]]
name = "deranged" name = "deranged"
@ -440,9 +440,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
[[package]] [[package]]
name = "fastrand" name = "fastrand"
version = "2.0.2" version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
[[package]] [[package]]
name = "finl_unicode" name = "finl_unicode"
@ -452,9 +452,9 @@ checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6"
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.28" version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"miniz_oxide", "miniz_oxide",
@ -666,9 +666,9 @@ dependencies = [
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.14.3" version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
[[package]] [[package]]
name = "heck" name = "heck"
@ -823,7 +823,7 @@ dependencies = [
"futures-util", "futures-util",
"http 0.2.12", "http 0.2.12",
"hyper 0.14.28", "hyper 0.14.28",
"rustls 0.21.11", "rustls 0.21.12",
"tokio", "tokio",
"tokio-rustls 0.24.1", "tokio-rustls 0.24.1",
] ]
@ -982,9 +982,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.153" version = "0.2.154"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
[[package]] [[package]]
name = "linked-hash-map" name = "linked-hash-map"
@ -1542,7 +1542,7 @@ dependencies = [
"once_cell", "once_cell",
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rustls 0.21.11", "rustls 0.21.12",
"rustls-pemfile 1.0.4", "rustls-pemfile 1.0.4",
"serde", "serde",
"serde_json", "serde_json",
@ -1568,7 +1568,7 @@ version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10"
dependencies = [ dependencies = [
"base64 0.22.0", "base64 0.22.1",
"bytes", "bytes",
"encoding_rs", "encoding_rs",
"futures-core", "futures-core",
@ -1650,9 +1650,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.21.11" version = "0.21.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
dependencies = [ dependencies = [
"log", "log",
"ring", "ring",
@ -1689,7 +1689,7 @@ version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d"
dependencies = [ dependencies = [
"base64 0.22.0", "base64 0.22.1",
"rustls-pki-types", "rustls-pki-types",
] ]
@ -1804,18 +1804,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.198" version = "1.0.200"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.198" version = "1.0.200"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1955,9 +1955,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.5.6" version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.52.0", "windows-sys 0.52.0",
@ -2142,9 +2142,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokenservice-client" name = "tokenservice-client"
version = "0.2.4" version = "0.2.6"
source = "sparse+https://git.toast-server.net/api/packages/toast/cargo/" source = "sparse+https://git.toast-server.net/api/packages/toast/cargo/"
checksum = "77a1324d7b287ed7e140130051ca732136ac5f6cfce1fdcf661e934e637be01d" checksum = "b5f825bc4385719640fdce352db60e7b32af2b2c9ebf4d52990cf46e7563f07a"
dependencies = [ dependencies = [
"reqwest 0.12.4", "reqwest 0.12.4",
"serde", "serde",
@ -2223,7 +2223,7 @@ version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
dependencies = [ dependencies = [
"rustls 0.21.11", "rustls 0.21.12",
"tokio", "tokio",
] ]
@ -2535,7 +2535,7 @@ version = "2.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd" checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd"
dependencies = [ dependencies = [
"base64 0.22.0", "base64 0.22.1",
"flate2", "flate2",
"log", "log",
"once_cell", "once_cell",
@ -2917,9 +2917,9 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.6.6" version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352" checksum = "14b9415ee827af173ebb3f15f9083df5a122eb93572ec28741fb153356ea2578"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]

View File

@ -1,16 +1,25 @@
FROM rust:1.78-alpine3.19@sha256:eb37f58646a901dc7727cf448cae36daaefaba79de33b5058dab79aa4c04aefb AS compiler FROM rust:1.77-alpine3.19 AS chef
ENV RUSTFLAGS="-C target-feature=-crt-static" ENV RUSTFLAGS -C target-feature=-crt-static
ARG CARGO_TOKEN ARG CARGO_TOKEN
RUN apk add --no-cache openssl-dev musl-dev RUN apk add --no-cache openssl-dev musl-dev
RUN cargo install cargo-chef
WORKDIR /usr/src/kon WORKDIR /usr/src/kon
FROM chef AS planner
COPY . . COPY . .
RUN mkdir -p .cargo && \ RUN mkdir -p .cargo && \
printf '[registries.gitea]\nindex = "sparse+https://git.toast-server.net/api/packages/toast/cargo/"\ntoken = "Bearer %s"\n' "$CARGO_TOKEN" >> .cargo/config.toml printf '[registries.gitea]\nindex = "sparse+https://git.toast-server.net/api/packages/toast/cargo/"\ntoken = "Bearer %s"\n' "$CARGO_TOKEN" >> .cargo/config.toml
RUN cargo fetch && cargo build -r RUN cargo chef prepare
FROM chef AS builder
COPY --from=planner /usr/src/kon/recipe.json recipe.json
RUN cargo chef cook --release
COPY . .
RUN cargo build -r
FROM alpine:3.19@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b FROM alpine:3.19@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b
RUN apk add --no-cache openssl-dev libgcc RUN apk add --no-cache libgcc
WORKDIR /kon WORKDIR /kon
COPY --from=compiler /usr/src/kon/target/release/kon . COPY --from=builder /usr/src/kon/target/release/kon .
COPY --from=compiler /usr/src/kon/Cargo.toml . COPY --from=builder /usr/src/kon/Cargo.toml .
CMD [ "./kon" ] CMD ./kon

View File

@ -18,6 +18,7 @@
"branchTopic": "{{{datasource}}}-{{{depName}}}-vulnerability", "branchTopic": "{{{datasource}}}-{{{depName}}}-vulnerability",
"prCreation": "immediate" "prCreation": "immediate"
}, },
"enabled": false,
"pinDigests": true, "pinDigests": true,
"ignoreTests": true, "ignoreTests": true,
"pruneStaleBranches": true, "pruneStaleBranches": true,
@ -25,9 +26,7 @@
"automerge": true, "automerge": true,
"automergeType": "pr", "automergeType": "pr",
"automergeStrategy": "squash", "automergeStrategy": "squash",
"automergeSchedule": [ "automergeSchedule": ["at any time"],
"at any time"
],
"packageRules": [ "packageRules": [
{ {
"matchManagers": ["cargo"], "matchManagers": ["cargo"],