From 3f87d011e73e92b48db0f0fe7bfecc33c67c3fda Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 18 Jan 2025 20:19:49 +0000 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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 }}