Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.67.0-buster as builder
FROM rust:1.85-bookworm as builder

WORKDIR /usr/src/app

Expand All @@ -7,7 +7,9 @@ COPY . .
RUN cargo build --release

# Now copy it into our base image.
FROM gcr.io/distroless/cc-debian10
FROM gcr.io/distroless/cc-debian12:nonroot

COPY --from=builder /usr/src/app/target/release/rust-tokenizers-api /usr/local/bin/rust-tokenizers-api
CMD ["rust-tokenizers-api"]
EXPOSE 8000
USER nonroot:nonroot
ENTRYPOINT ["/usr/local/bin/rust-tokenizers-api"]
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,14 @@ Note that it is a good practice to use `404 Not Found` to protect from requests
| GET | POST | PUT | HEAD|
|---|---|---|---|
| Read Only | Write Only | Update existing | Does it exist? |


### HOW TO USE:
docker build . -t local-rust-distroless
docker images | grep local-rust-distroless
docker run -p 8000:8000 local-rust-distroless

#### In a different terminal
curl -X POST --data '{"text": "some text"}' --header "Content-Type: application/json" http://localhost:8000/tokenizers/bert-base-cased

curl -X POST --data '{"text": "some text"}' --header "Content-Type: application/json" http://localhost:8000/tokenizers/bert-base-uncased
Loading