update rust toolchain to 1.82 (#255)

* update rust to 1.82 pin it, also update envoy to 1.32 and python to 3.13

* use python:3.12
This commit is contained in:
Adil Hafeez 2024-11-12 10:35:14 -08:00 committed by GitHub
parent 4b2b371876
commit d87105882b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 28 additions and 28 deletions

View file

@ -18,13 +18,13 @@ jobs:
uses: actions/checkout@v4
- name: Setup | Rust
run: rustup toolchain install stable --profile minimal
run: rustup toolchain install 1.82 --profile minimal
- name: Setup | Install wasm toolchain
run: rustup target add wasm32-wasi
run: rustup target add wasm32-wasip1
- name: Build wasm module
run: cargo build --release --target=wasm32-wasi
run: cargo build --release --target=wasm32-wasip1
- name: Run unit tests
run: cargo test --lib

View file

@ -1,22 +1,22 @@
# build filter using rust toolchain
FROM rust:1.80.0 as builder
RUN rustup -v target add wasm32-wasi
FROM rust:1.82.0 as builder
RUN rustup -v target add wasm32-wasip1
WORKDIR /arch
COPY crates .
RUN cd prompt_gateway && cargo build --release --target wasm32-wasi
RUN cd llm_gateway && cargo build --release --target wasm32-wasi
RUN cd prompt_gateway && cargo build --release --target wasm32-wasip1
RUN cd llm_gateway && cargo build --release --target wasm32-wasip1
# copy built filter into envoy image
FROM envoyproxy/envoy:v1.31-latest as envoy
FROM envoyproxy/envoy:v1.32-latest as envoy
#Build config generator, so that we have a single build image for both Rust and Python
FROM python:3-slim as arch
FROM python:3.12-slim as arch
RUN apt-get update && apt-get install -y gettext-base curl && apt-get clean && rm -rf /var/lib/apt/lists/*
COPY --from=builder /arch/target/wasm32-wasi/release/prompt_gateway.wasm /etc/envoy/proxy-wasm-plugins/prompt_gateway.wasm
COPY --from=builder /arch/target/wasm32-wasi/release/llm_gateway.wasm /etc/envoy/proxy-wasm-plugins/llm_gateway.wasm
COPY --from=builder /arch/target/wasm32-wasip1/release/prompt_gateway.wasm /etc/envoy/proxy-wasm-plugins/prompt_gateway.wasm
COPY --from=builder /arch/target/wasm32-wasip1/release/llm_gateway.wasm /etc/envoy/proxy-wasm-plugins/llm_gateway.wasm
COPY --from=envoy /usr/local/bin/envoy /usr/local/bin/envoy
WORKDIR /config
COPY arch/requirements.txt .

View file

@ -3,13 +3,13 @@
## Add toolchain
```sh
$ rustup target add wasm32-wasi
$ rustup target add wasm32-wasip1
```
## Building
```sh
$ cargo build --target wasm32-wasi --release
$ cargo build --target wasm32-wasip1 --release
```
## Testing
@ -25,7 +25,7 @@ $ cargo test
- Build filter binary,
```
$ cargo build --target wasm32-wasi --release
$ cargo build --target wasm32-wasip1 --release
```
- Start envoy with arch_config.yaml and test,
```

View file

@ -13,8 +13,8 @@ services:
- ./envoy.template.yaml:/config/envoy.template.yaml
- ./arch_config_schema.yaml:/config/arch_config_schema.yaml
- ./tools/cli/config_generator.py:/config/config_generator.py
- ../crates/target/wasm32-wasi/release/llm_gateway.wasm:/etc/envoy/proxy-wasm-plugins/llm_gateway.wasm
- ../crates/target/wasm32-wasi/release/prompt_gateway.wasm:/etc/envoy/proxy-wasm-plugins/prompt_gateway.wasm
- ../crates/target/wasm32-wasip1/release/llm_gateway.wasm:/etc/envoy/proxy-wasm-plugins/llm_gateway.wasm
- ../crates/target/wasm32-wasip1/release/prompt_gateway.wasm:/etc/envoy/proxy-wasm-plugins/prompt_gateway.wasm
- ~/archgw_logs:/var/log/
extra_hosts:
- "host.docker.internal:host-gateway"

View file

@ -7,10 +7,10 @@ use serial_test::serial;
use std::path::Path;
fn wasm_module() -> String {
let wasm_file = Path::new("../target/wasm32-wasi/release/llm_gateway.wasm");
let wasm_file = Path::new("../target/wasm32-wasip1/release/llm_gateway.wasm");
assert!(
wasm_file.exists(),
"Run `cargo build --release --target=wasm32-wasi` first"
"Run `cargo build --release --target=wasm32-wasip1` first"
);
wasm_file.to_str().unwrap().to_string()
}

View file

@ -17,10 +17,10 @@ use std::collections::HashMap;
use std::path::Path;
fn wasm_module() -> String {
let wasm_file = Path::new("../target/wasm32-wasi/release/prompt_gateway.wasm");
let wasm_file = Path::new("../target/wasm32-wasip1/release/prompt_gateway.wasm");
assert!(
wasm_file.exists(),
"Run `cargo build --release --target=wasm32-wasi` first"
"Run `cargo build --release --target=wasm32-wasip1` first"
);
wasm_file.to_str().unwrap().to_string()
}

View file

@ -1,4 +1,4 @@
FROM python:3.10 AS base
FROM python:3.12 AS base
FROM base AS builder
@ -7,7 +7,7 @@ WORKDIR /src
COPY requirements.txt /src/
RUN pip install --prefix=/runtime --force-reinstall -r requirements.txt
FROM python:3.10-slim AS output
FROM python:3.12-slim AS output
COPY --from=builder /runtime /usr/local
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM python:3.10 AS base
FROM python:3.12 AS base
FROM base AS builder
@ -9,7 +9,7 @@ RUN pip install --prefix=/runtime --force-reinstall -r requirements.txt
COPY . /src
FROM python:3.10-slim AS output
FROM python:3.12-slim AS output
COPY --from=builder /runtime /usr/local

View file

@ -1,4 +1,4 @@
FROM python:3.10 AS base
FROM python:3.12 AS base
FROM base AS builder
@ -8,7 +8,7 @@ COPY requirements.txt /src/
RUN pip install --prefix=/runtime --force-reinstall -r requirements.txt
FROM python:3.10-slim AS output
FROM python:3.12-slim AS output
COPY --from=builder /runtime /usr/local

View file

@ -1,9 +1,9 @@
FROM python:3.10 AS builder
FROM python:3.12 AS builder
COPY requirements.txt .
RUN pip install --prefix=/runtime -r requirements.txt
FROM python:3.10-slim AS output
FROM python:3.12-slim AS output
# curl is needed for health check in docker-compose
RUN apt-get update && apt-get install -y curl && apt-get clean && rm -rf /var/lib/apt/lists/*