Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
e06202941f | |||
|
db523065e0 | ||
|
3f87d011e7 |
8 changed files with 63 additions and 39 deletions
|
@ -5,22 +5,40 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: ubuntu:latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Clear image from cache
|
- name: login to docker registry
|
||||||
run: |
|
uses: docker/login-action@v3
|
||||||
docker images git.kemitix.net/${{ env.GITHUB_REPOSITORY }} -q | sort -u | xargs -r docker rmi --force
|
with:
|
||||||
docker system prune --force --all
|
registry: git.ragarock.moe
|
||||||
|
username: silvana
|
||||||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
- name: Build
|
- name: setup buildx
|
||||||
run: docker build . -t git.kemitix.net/${{ env.GITHUB_REPOSITORY }}:latest
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login
|
- name: build and push
|
||||||
run: docker login git.kemitix.net --username kemitix --password ${{ secrets.FORGEJO_TOKEN_WRITE_PACKAGE }}
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: git.ragarock.moe/${{ env.GITHUB_REPOSITORY }}:latest
|
||||||
|
|
||||||
- name: Publish
|
# - name: Clear image from cache
|
||||||
run: docker push git.kemitix.net/${{ env.GITHUB_REPOSITORY }}:latest
|
# 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
|
||||||
|
|
|
@ -6,8 +6,7 @@ jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image:
|
image: git.ragarock.moe/silvana/rust:latest
|
||||||
git.kemitix.net/kemitix/rust:latest
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
toolchain:
|
toolchain:
|
||||||
|
|
|
@ -4,6 +4,5 @@ version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
kxio = "5.0"
|
kxio = "5.1"
|
||||||
native-tls = { version = "0.2", features = ["vendored"] }
|
|
||||||
tokio = { version = "1.43", features = ["full"] }
|
tokio = { version = "1.43", features = ["full"] }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FROM docker.io/rust:1.84.0-alpine3.21
|
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 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 && \
|
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 && \
|
||||||
|
@ -39,6 +39,7 @@ RUN apk add --no-cache \
|
||||||
libssl3 \
|
libssl3 \
|
||||||
openssl-dev \
|
openssl-dev \
|
||||||
perl \
|
perl \
|
||||||
|
dbus-dev \
|
||||||
git
|
git
|
||||||
|
|
||||||
# clang \
|
# clang \
|
||||||
|
@ -47,8 +48,8 @@ RUN apk add --no-cache \
|
||||||
|
|
||||||
# dbus-dev \
|
# dbus-dev \
|
||||||
|
|
||||||
RUN git config --global user.email "action@git.kemitix.net" && \
|
RUN git config --global user.email "holo@ragarock.moe" && \
|
||||||
git config --global user.name "ForgeJo Action. See: https://git.kemitix.net/kemitix/rust"
|
git config --global user.name "ForgeJo Action. See: https://git.ragarock.moe/silvana/rust"
|
||||||
|
|
||||||
COPY scripts/ /usr/local/bin/
|
COPY scripts/ /usr/local/bin/
|
||||||
|
|
||||||
|
|
26
README.md
26
README.md
|
@ -42,6 +42,7 @@ The available toolchain in the image are:
|
||||||
- cargo-chef
|
- cargo-chef
|
||||||
- cargo-hack
|
- cargo-hack
|
||||||
- release-plz
|
- release-plz
|
||||||
|
- dbus-dev
|
||||||
- perl
|
- perl
|
||||||
|
|
||||||
### Scripts
|
### Scripts
|
||||||
|
@ -61,10 +62,33 @@ steps:
|
||||||
|
|
||||||
## Caveats
|
## 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.
|
This crate *must* use the `vendored` feature in order to compile in the Alpine Linux image.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
native-tls = { version = "0.2", features = ["vendored"] }
|
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",
|
||||||
|
] }
|
||||||
|
```
|
||||||
|
|
2
justfile
2
justfile
|
@ -1,4 +1,4 @@
|
||||||
image := "git.kemitix.get/kemitix/rust:test"
|
image := "git.ragarock.moe/silvana/rust:test"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
docker build . -t {{ image }}
|
docker build . -t {{ image }}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
//
|
//
|
||||||
mod kxio;
|
mod kxio;
|
||||||
mod tls;
|
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
println!("Hello, world!");
|
println!("Hello, world!");
|
||||||
tls::main();
|
|
||||||
|
|
||||||
let rt = tokio::runtime::Runtime::new()?;
|
let rt = tokio::runtime::Runtime::new()?;
|
||||||
Ok(rt.block_on(crate::kxio::main())?)
|
Ok(rt.block_on(crate::kxio::main())?)
|
||||||
|
|
15
src/tls.rs
15
src/tls.rs
|
@ -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));
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue