From 7ab30ce7c30e20246112d31829b937247a18729d Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 14 Jan 2025 09:06:08 +0000 Subject: [PATCH 01/17] feat: add bash to image --- .forgejo/workflows/push-next.yml | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/push-next.yml b/.forgejo/workflows/push-next.yml index 391d3b7..6c800c1 100644 --- a/.forgejo/workflows/push-next.yml +++ b/.forgejo/workflows/push-next.yml @@ -7,7 +7,7 @@ jobs: runs-on: docker container: image: - git.kemitix.net/kemitix/rust:latest + git.kemitix.net/kemitix/rust:v3.1.0 strategy: matrix: toolchain: diff --git a/Dockerfile b/Dockerfile index 7e8529e..34f2553 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ LABEL org.opencontainers.image.source=https://git.kemitix.net/kemitix/rust # openssl-dev - build dependency for git-next # dbus-dev - linux os interop (e.g. desktop notifications) # git - git -RUN apk add nodejs curl clang pkgconfig mold openssl-dev dbus-dev git +RUN apk add nodejs curl clang pkgconfig mold openssl-dev dbus-dev git bash RUN curl -L https://github.com/cargo-bins/cargo-binstall/releases/download/v1.10.19/cargo-binstall-x86_64-unknown-linux-musl.tgz -o cargo-binstall.tgz && \ tar -xzf cargo-binstall.tgz && \ From 9a12ffc5fcf54f5cd1f8cee974d8ce2d85a3e6d8 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 14 Jan 2025 20:09:30 +0000 Subject: [PATCH 02/17] chore: add build recipe to justfile --- justfile | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 justfile diff --git a/justfile b/justfile new file mode 100644 index 0000000..2071a21 --- /dev/null +++ b/justfile @@ -0,0 +1,2 @@ +build: + docker build . -t git.kemitix.net/kemitix/rust:latest From 6aa876047af109889749d3e08369b6ac62cfa750 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 14 Jan 2025 20:09:30 +0000 Subject: [PATCH 03/17] fix: should build with libssl dependency --- Cargo.toml | 1 + examples/native-tls.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 examples/native-tls.rs diff --git a/Cargo.toml b/Cargo.toml index 7d75412..133dad7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,3 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies] +native-tls = "0.2" diff --git a/examples/native-tls.rs b/examples/native-tls.rs new file mode 100644 index 0000000..32acc40 --- /dev/null +++ b/examples/native-tls.rs @@ -0,0 +1,15 @@ +use native_tls::TlsConnector; +use std::io::{Read, Write}; +use std::net::TcpStream; + +fn main() { + let connector = TlsConnector::new().unwrap(); + + let stream = TcpStream::connect("google.com:443").unwrap(); + let mut stream = connector.connect("google.com", stream).unwrap(); + + stream.write_all(b"GET / HTTP/1.0\r\n\r\n").unwrap(); + let mut res = vec![]; + stream.read_to_end(&mut res).unwrap(); + println!("{}", String::from_utf8_lossy(&res)); +} From 2c8b4776d9ea486ff49eeacfca1cb6d7a69c4227 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 14 Jan 2025 20:09:30 +0000 Subject: [PATCH 04/17] chore: use --no-chache and libssl3 + build-base packages --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 34f2553..80e35d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ LABEL org.opencontainers.image.source=https://git.kemitix.net/kemitix/rust # openssl-dev - build dependency for git-next # dbus-dev - linux os interop (e.g. desktop notifications) # git - git -RUN apk add nodejs curl clang pkgconfig mold openssl-dev dbus-dev git bash +RUN apk add --no-cache nodejs curl clang pkgconfig mold libssl3 openssl-dev build-base dbus-dev git bash RUN curl -L https://github.com/cargo-bins/cargo-binstall/releases/download/v1.10.19/cargo-binstall-x86_64-unknown-linux-musl.tgz -o cargo-binstall.tgz && \ tar -xzf cargo-binstall.tgz && \ From 28d34eb85d413d53441423fe26cc1a2f8267600b Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 14 Jan 2025 20:59:32 +0000 Subject: [PATCH 05/17] fix: remove rust 1.74.1 --- .forgejo/workflows/push-next.yml | 1 - Dockerfile | 3 --- 2 files changed, 4 deletions(-) diff --git a/.forgejo/workflows/push-next.yml b/.forgejo/workflows/push-next.yml index 6c800c1..4a57795 100644 --- a/.forgejo/workflows/push-next.yml +++ b/.forgejo/workflows/push-next.yml @@ -13,7 +13,6 @@ jobs: toolchain: - name: stable - name: nightly - - name: 1.74.1 steps: - uses: actions/checkout@v4 diff --git a/Dockerfile b/Dockerfile index 80e35d8..fa25064 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,9 +23,6 @@ RUN cargo binstall -y \ cargo-mutants@25.0 \ release-plz@0.3 -# install v1.74.1 -RUN rustup install 1.74.1 && rustup component add --toolchain 1.74.1 rustfmt clippy - # should be a no-op if the FROM line is up-to-date RUN rustup update stable && rustup component add --toolchain stable rustfmt clippy From 4bd50bdadff89a472c362f115a0078a02c7f4747 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 14 Jan 2025 20:59:32 +0000 Subject: [PATCH 06/17] build: justfile adds test and shell recipes --- justfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/justfile b/justfile index 2071a21..c1a8fa3 100644 --- a/justfile +++ b/justfile @@ -1,2 +1,10 @@ +image := "git.kemitix.get/kemitix/rust:test" + build: - docker build . -t git.kemitix.net/kemitix/rust:latest + docker build . -t {{ image }} + +test: build + docker run --rm -v $PWD:/app/ {{ image }} cargo test + +shell: build + docker run --rm -it -v $PWD:/app/ {{ image }} bash From e2f2015e062e5e254e92358ec13d237e8d22b9c5 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 14 Jan 2025 20:59:32 +0000 Subject: [PATCH 07/17] test: add regression test for native-tls crate --- Cargo.toml | 2 +- src/main.rs | 10 ++++++++++ examples/native-tls.rs => src/tls.rs | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) rename examples/native-tls.rs => src/tls.rs (96%) diff --git a/Cargo.toml b/Cargo.toml index 133dad7..7fa380b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies] -native-tls = "0.2" +native-tls = { version = "0.2", features = ["vendored"] } diff --git a/src/main.rs b/src/main.rs index e7a11a9..f39eee9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,13 @@ +mod tls; fn main() { println!("Hello, world!"); + tls::main(); +} + +#[cfg(test)] +mod tests { + #[test] + fn passes() { + println!("passes okay"); + } } diff --git a/examples/native-tls.rs b/src/tls.rs similarity index 96% rename from examples/native-tls.rs rename to src/tls.rs index 32acc40..f4cb49c 100644 --- a/examples/native-tls.rs +++ b/src/tls.rs @@ -2,7 +2,7 @@ use native_tls::TlsConnector; use std::io::{Read, Write}; use std::net::TcpStream; -fn main() { +pub fn main() { let connector = TlsConnector::new().unwrap(); let stream = TcpStream::connect("google.com:443").unwrap(); From f1a2ae0311fb5c63550685fa398f9135103dd5ac Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 14 Jan 2025 20:59:32 +0000 Subject: [PATCH 08/17] feat: install most apks later --- Dockerfile | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index fa25064..126dadf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,15 +2,7 @@ FROM docker.io/rust:1.84.0-alpine3.21 LABEL org.opencontainers.image.source=https://git.kemitix.net/kemitix/rust -# nodejs - runtime used by forgejo/github actions -# curl - to download cargo-binstall -# clang & mold - faster linkers for rust -# pkgconfig - required to compile some rust `-sys` packages -# openssl-dev - build dependency for git-next -# dbus-dev - linux os interop (e.g. desktop notifications) -# git - git -RUN apk add --no-cache nodejs curl clang pkgconfig mold libssl3 openssl-dev build-base dbus-dev git bash - +RUN apk add --no-cache curl=8.11.1-r0 RUN curl -L https://github.com/cargo-bins/cargo-binstall/releases/download/v1.10.19/cargo-binstall-x86_64-unknown-linux-musl.tgz -o cargo-binstall.tgz && \ tar -xzf cargo-binstall.tgz && \ rm cargo-binstall.tgz && \ @@ -24,11 +16,37 @@ RUN cargo binstall -y \ release-plz@0.3 # should be a no-op if the FROM line is up-to-date -RUN rustup update stable && rustup component add --toolchain stable rustfmt clippy +RUN rustup update stable + +RUN rustup component add rustfmt clippy # install nightly RUN rustup install nightly && rustup component add --toolchain nightly rustfmt clippy +# nodejs - runtime used by forgejo/github actions +# curl - to download cargo-binstall +# clang & mold - faster linkers for rust +# pkgconfig - required to compile some rust `-sys` packages +# openssl-dev - build dependency for git-next +# dbus-dev - linux os interop (e.g. desktop notifications) +# perl - native-tls(vendored) +# git - git +RUN apk add --no-cache \ + bash \ + nodejs \ + build-base \ + pkgconfig \ + libssl3 \ + openssl-dev \ + perl \ + git + + # clang \ + + # mold \ + + # dbus-dev \ + RUN git config --global user.email "action@git.kemitix.net" && \ git config --global user.name "ForgeJo Action. See: https://git.kemitix.net/kemitix/rust" From 0c1f4ba125105ac9b91d8253ced4c6bfac099ae0 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 14 Jan 2025 20:59:32 +0000 Subject: [PATCH 09/17] docs: update readme to include caveat --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 9e42799..6a73835 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ The available toolchain in the image are: - cargo-chef - cargo-hack - release-plz +- perl ### Scripts @@ -57,3 +58,13 @@ steps: - name: Check for Ignored Files run: check-for-ignored ``` + +## Caveats + +### native-tls + +This crate *must* use the `vendored` feature in order to compile in the Alpine Linux image. + +```toml +native-tls = { version = "0.2", features = ["vendored"] } +``` From 97f794a36e7a7630dd36b07b900d47851c895a9e Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 14 Jan 2025 20:59:32 +0000 Subject: [PATCH 10/17] build: add clippy recipe to justfile --- justfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/justfile b/justfile index c1a8fa3..30f08b2 100644 --- a/justfile +++ b/justfile @@ -6,5 +6,8 @@ build: test: build docker run --rm -v $PWD:/app/ {{ image }} cargo test +clippy: build + docker run --rm -v $PWD:/app/ {{ image }} cargo clippy + shell: build docker run --rm -it -v $PWD:/app/ {{ image }} bash From ee426b1a430de8b5ad245f7a2d035cb1400bc5fe Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 14 Jan 2025 20:52:01 +0000 Subject: [PATCH 11/17] fix: should build with kxio dependency --- Cargo.toml | 2 + justfile | 3 ++ src/kxio.rs | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.rs | 8 +++- 4 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 src/kxio.rs diff --git a/Cargo.toml b/Cargo.toml index 7fa380b..41fa947 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,4 +4,6 @@ version = "0.1.0" edition = "2021" [dependencies] +kxio = "5.0" native-tls = { version = "0.2", features = ["vendored"] } +tokio = { version = "1.43", features = ["full"] } diff --git a/justfile b/justfile index 30f08b2..b5f2749 100644 --- a/justfile +++ b/justfile @@ -9,5 +9,8 @@ test: build clippy: build docker run --rm -v $PWD:/app/ {{ image }} cargo clippy +run: build + docker run --rm -v $PWD:/app/ {{ image }} cargo run + shell: build docker run --rm -it -v $PWD:/app/ {{ image }} bash diff --git a/src/kxio.rs b/src/kxio.rs new file mode 100644 index 0000000..1d56825 --- /dev/null +++ b/src/kxio.rs @@ -0,0 +1,105 @@ +/// This is an example to show fetching a file from a webiste and saving to a file +/// +/// The example consts of: +/// +/// - The main program, in `main()` - demonstrates how to setup `kxio` for use in prod +/// - A test module - demonstrates how to use `kxio` in tests +/// - sample functions - showing how to use `kxio` the body of your program, and be testable +/// +/// NOTE: running this program with `cargo run --example get` will create and delete the file +/// `example-readme.md` in the current directory. +use std::path::Path; + +use kxio::fs::FileHandle; + +// #[tokio::main] +pub async fn main() -> kxio::Result<()> { + // Create a `Net` object for making real network requests. + let net: kxio::net::Net = kxio::net::new(); + + // Create a `FileSystem` object for accessing files within the current directory. + // The object created will return a `PathTraveral` error result if there is an attempt to\ + // access a file outside of this directory. + let current_dir = std::env::current_dir().map_err(kxio::fs::Error::Io)?; + let fs: kxio::fs::FileSystem = kxio::fs::new(current_dir); + + // The URL we will fetch - the readme for this library. + let url = "https://git.kemitix.net/kemitix/kxio/raw/branch/main/README.md"; + + // Create a PathBuf to a file within the directory that the `fs` object has access to. + let file_path = fs.base().join("example-readme.md"); + + // Create a generic handle for the file. This doesn't open the file, and always succeeds. + let path = fs.path(&file_path); + + // Other options are; + // `fs.file(&file_path)` - for a file + // `fs.dir(&dir_path)` - for a directory + + // Checks if the path exists (whether a file, directory, etc) + if path.exists()? { + eprintln!("The file {path} already exists. Aborting!"); + return Ok(()); + } + + // Passes a reference to the `fs` and `net` objects for use by your program. + // Your programs should not know whether they are handling a mock or the real thing. + // Any file or network access should be made using these handlers to be properly testable. + let file = download_and_save_to_file(url, &file_path, &fs, &net).await?; + read_file(&file)?; + delete_file(file)?; + + Ok(()) +} + +/// An function that uses a `FileSystem` and a `Net` object to interact with the outside world. +async fn download_and_save_to_file( + url: &str, + file_path: &Path, + // The filesystem abstraction + fs: &kxio::fs::FileSystem, + // The network abstraction + net: &kxio::net::Net, +) -> kxio::Result { + println!("fetching: {url}"); + + // Makes a GET request that can be mocked in a test + let response = net.get(url).header("key", "value").send().await?; + + // As you can see, we use [reqwest] under the hood. + // + // If you need to create a more complex request than the [kxio] fluent API allows, you + // can create a request using [reqwest] and pass it to [net.send(request)]. + + let body = response.text().await?; + println!("fetched {} bytes", body.bytes().len()); + + // Uses the file system abstraction to create a handle for a file. + let file: kxio::fs::PathReal = fs.file(file_path); + println!("writing file: {file}"); + // Writes the body to the file. + file.write(body)?; + + Ok(file) +} + +/// A function that reads the file contents +fn read_file(file: &FileHandle) -> kxio::Result<()> { + println!("reading file: {file}"); + + // Creates a `Reader` which loaded the file into memory. + let reader: kxio::fs::Reader = file.reader()?; + let contents: &str = reader.as_str()?; + println!("{contents}"); + + Ok(()) +} + +/// A function that deletes the file +fn delete_file(file: FileHandle) -> kxio::Result<()> { + println!("deleting file: {file}"); + + file.remove()?; + + Ok(()) +} diff --git a/src/main.rs b/src/main.rs index f39eee9..341c44b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,13 @@ +// +mod kxio; mod tls; -fn main() { + +fn main() -> Result<(), Box> { println!("Hello, world!"); tls::main(); + + let rt = tokio::runtime::Runtime::new()?; + Ok(rt.block_on(crate::kxio::main())?) } #[cfg(test)] From 2a9c2cef76a0dd8d736378e512d8034e21892745 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Thu, 16 Jan 2025 08:25:16 +0000 Subject: [PATCH 12/17] fix: add cargo components to toolchain stable-x86_64-unknown-linux-musl --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 126dadf..e301952 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ RUN cargo binstall -y \ # should be a no-op if the FROM line is up-to-date RUN rustup update stable -RUN rustup component add rustfmt clippy +RUN rustup component add --toolchain stable-x86_64-unknown-linux-musl rustfmt clippy # install nightly RUN rustup install nightly && rustup component add --toolchain nightly rustfmt clippy From 05d4233d3f83337406f89eff238a2544456a2ef5 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Thu, 16 Jan 2025 08:25:16 +0000 Subject: [PATCH 13/17] build: add fmt recipe to justfile --- justfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/justfile b/justfile index b5f2749..223b3a8 100644 --- a/justfile +++ b/justfile @@ -12,5 +12,8 @@ clippy: build run: build docker run --rm -v $PWD:/app/ {{ image }} cargo run +fmt: build + docker run --rm -v $PWD:/app/ {{ image }} cargo fmt + shell: build docker run --rm -it -v $PWD:/app/ {{ image }} bash From 26c46227e665358328eeafbee01b7bc3e68cde4c Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 14 Jan 2025 20:59:32 +0000 Subject: [PATCH 14/17] feat: push-next uses 'latest' image --- .forgejo/workflows/push-next.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/push-next.yml b/.forgejo/workflows/push-next.yml index 4a57795..3de00fb 100644 --- a/.forgejo/workflows/push-next.yml +++ b/.forgejo/workflows/push-next.yml @@ -7,7 +7,7 @@ jobs: runs-on: docker container: image: - git.kemitix.net/kemitix/rust:v3.1.0 + git.kemitix.net/kemitix/rust:latest strategy: matrix: toolchain: From 3f87d011e73e92b48db0f0fe7bfecc33c67c3fda Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 18 Jan 2025 20:19:49 +0000 Subject: [PATCH 15/17] feat: add dbus-dev to image --- Dockerfile | 1 + README.md | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e301952..f638a27 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,6 +39,7 @@ RUN apk add --no-cache \ libssl3 \ openssl-dev \ perl \ + dbus-dev \ git # clang \ diff --git a/README.md b/README.md index 6a73835..cf908c1 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ The available toolchain in the image are: - cargo-chef - cargo-hack - release-plz +- dbus-dev - perl ### Scripts @@ -61,10 +62,33 @@ steps: ## Caveats -### native-tls +### openssl + +The alpine linux install doesn't build with this dependency. You can either compile `native-tls` with the `vendored` feature, or not use `openssl`. + +#### vendoered native-tls This crate *must* use the `vendored` feature in order to compile in the Alpine Linux image. ```toml native-tls = { version = "0.2", features = ["vendored"] } ``` + +#### Don't use `openssl` + +Check that none of your dependencies require `openssl`: + +```bash +cargo tree --edges normal -i openssl +``` + +This will list the tree of dependencies that are bringing in `openssl`. + +If you do need ssl/tls, try using `rustls`. e.g. + +```toml +reqwest = { version = "0.12", default-features = false, features = [ + "json", + "rustls-tls", +] } +``` From db523065e02d00d16d800e41b36f0b5279c2da39 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 18 Jan 2025 20:52:20 +0000 Subject: [PATCH 16/17] feat: remove openssl transitive dependency --- Cargo.toml | 3 +-- justfile | 2 +- src/main.rs | 2 -- src/tls.rs | 15 --------------- 4 files changed, 2 insertions(+), 20 deletions(-) delete mode 100644 src/tls.rs diff --git a/Cargo.toml b/Cargo.toml index 41fa947..4b31261 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,5 @@ version = "0.1.0" edition = "2021" [dependencies] -kxio = "5.0" -native-tls = { version = "0.2", features = ["vendored"] } +kxio = "5.1" tokio = { version = "1.43", features = ["full"] } diff --git a/justfile b/justfile index 223b3a8..60bdbb1 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,4 @@ -image := "git.kemitix.get/kemitix/rust:test" +image := "git.kemitix.net/kemitix/rust:test" build: docker build . -t {{ image }} diff --git a/src/main.rs b/src/main.rs index 341c44b..93488b4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,8 @@ // mod kxio; -mod tls; fn main() -> Result<(), Box> { println!("Hello, world!"); - tls::main(); let rt = tokio::runtime::Runtime::new()?; Ok(rt.block_on(crate::kxio::main())?) diff --git a/src/tls.rs b/src/tls.rs deleted file mode 100644 index f4cb49c..0000000 --- a/src/tls.rs +++ /dev/null @@ -1,15 +0,0 @@ -use native_tls::TlsConnector; -use std::io::{Read, Write}; -use std::net::TcpStream; - -pub fn main() { - let connector = TlsConnector::new().unwrap(); - - let stream = TcpStream::connect("google.com:443").unwrap(); - let mut stream = connector.connect("google.com", stream).unwrap(); - - stream.write_all(b"GET / HTTP/1.0\r\n\r\n").unwrap(); - let mut res = vec![]; - stream.read_to_end(&mut res).unwrap(); - println!("{}", String::from_utf8_lossy(&res)); -} From e06202941f4f089d02b7dc5850f1106dba6819bd Mon Sep 17 00:00:00 2001 From: silvana Date: Mon, 20 Jan 2025 08:14:40 +0100 Subject: [PATCH 17/17] fix(rename): modify to use my forgejo instance. --- .forgejo/workflows/build-image.yml | 44 +++++++++++++++++++++--------- .forgejo/workflows/push-next.yml | 3 +- Dockerfile | 6 ++-- justfile | 2 +- 4 files changed, 36 insertions(+), 19 deletions(-) diff --git a/.forgejo/workflows/build-image.yml b/.forgejo/workflows/build-image.yml index d5c200e..3794bd8 100644 --- a/.forgejo/workflows/build-image.yml +++ b/.forgejo/workflows/build-image.yml @@ -5,22 +5,40 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: docker + container: + image: ubuntu:latest steps: - - name: Checkout - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - - name: Clear image from cache - run: | - docker images git.kemitix.net/${{ env.GITHUB_REPOSITORY }} -q | sort -u | xargs -r docker rmi --force - docker system prune --force --all + - name: login to docker registry + uses: docker/login-action@v3 + with: + registry: git.ragarock.moe + username: silvana + password: ${{ secrets.REGISTRY_TOKEN }} - - name: Build - run: docker build . -t git.kemitix.net/${{ env.GITHUB_REPOSITORY }}:latest + - name: setup buildx + uses: docker/setup-buildx-action@v3 - - name: Login - run: docker login git.kemitix.net --username kemitix --password ${{ secrets.FORGEJO_TOKEN_WRITE_PACKAGE }} + - name: build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: git.ragarock.moe/${{ env.GITHUB_REPOSITORY }}:latest - - name: Publish - run: docker push git.kemitix.net/${{ env.GITHUB_REPOSITORY }}:latest + # - name: Clear image from cache + # run: | + # docker images git.ragarock.moe/${{ env.GITHUB_REPOSITORY }} -q | sort -u | xargs -r docker rmi --force + # docker system prune --force --all + + # - name: Build + # run: docker build . -t git.ragarock.moe/${{ env.GITHUB_REPOSITORY }}:latest + + # - name: Login + # run: docker login git.ragarock.moe --username silvana --password ${{ secrets.FORGEJO_TOKEN_WRITE_PACKAGE }} + + # - name: Publish + # run: docker push git.ragarock.moe/${{ env.GITHUB_REPOSITORY }}:latest diff --git a/.forgejo/workflows/push-next.yml b/.forgejo/workflows/push-next.yml index 3de00fb..8aca99b 100644 --- a/.forgejo/workflows/push-next.yml +++ b/.forgejo/workflows/push-next.yml @@ -6,8 +6,7 @@ jobs: test: runs-on: docker container: - image: - git.kemitix.net/kemitix/rust:latest + image: git.ragarock.moe/silvana/rust:latest strategy: matrix: toolchain: diff --git a/Dockerfile b/Dockerfile index f638a27..15fbcaf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM docker.io/rust:1.84.0-alpine3.21 -LABEL org.opencontainers.image.source=https://git.kemitix.net/kemitix/rust +LABEL org.opencontainers.image.source=https://git.ragarock.moe/silvana/rust RUN apk add --no-cache curl=8.11.1-r0 RUN curl -L https://github.com/cargo-bins/cargo-binstall/releases/download/v1.10.19/cargo-binstall-x86_64-unknown-linux-musl.tgz -o cargo-binstall.tgz && \ @@ -48,8 +48,8 @@ RUN apk add --no-cache \ # dbus-dev \ -RUN git config --global user.email "action@git.kemitix.net" && \ - git config --global user.name "ForgeJo Action. See: https://git.kemitix.net/kemitix/rust" +RUN git config --global user.email "holo@ragarock.moe" && \ + git config --global user.name "ForgeJo Action. See: https://git.ragarock.moe/silvana/rust" COPY scripts/ /usr/local/bin/ diff --git a/justfile b/justfile index 60bdbb1..373ea93 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,4 @@ -image := "git.kemitix.net/kemitix/rust:test" +image := "git.ragarock.moe/silvana/rust:test" build: docker build . -t {{ image }}