Spaces:
Sleeping
Sleeping
Matrix
commited on
Commit
·
cd5240a
1
Parent(s):
095a7fa
feat: Dockerfile & docker-compose
Browse files- .dockerignore +6 -0
- Dockerfile +18 -41
- README.MD +1 -1
- docker-compose.yaml +16 -0
.dockerignore
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.idea/
|
2 |
+
static/
|
3 |
+
target/
|
4 |
+
docker-compose.yaml
|
5 |
+
Dockerfile
|
6 |
+
README.MD
|
Dockerfile
CHANGED
@@ -1,46 +1,23 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
# Install python3.11 and build dependencies
|
5 |
-
RUN apt-get update
|
6 |
-
RUN apt-get install -y software-properties-common
|
7 |
-
#RUN add-apt-repository ppa:deadsnakes/ppa
|
8 |
-
|
9 |
-
RUN apt-get update
|
10 |
-
RUN apt-get install -y libssl-dev cmake python3-dev curl pkg-config clang
|
11 |
-
|
12 |
-
# install rust toolchain
|
13 |
-
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
|
14 |
ENV PATH=/root/.cargo/bin:$PATH
|
|
|
|
|
15 |
|
16 |
-
|
17 |
-
COPY
|
18 |
-
|
19 |
-
# Download dependencies
|
20 |
-
RUN mkdir -p src/bin && echo "fn main() {println!(\"if you see this, the build broke\")}" > src/bin/bigbot.rs
|
21 |
-
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
22 |
-
--mount=type=cache,target=/usr/local/cargo/git \
|
23 |
-
cargo build --release
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
# Build the project with release profile
|
28 |
-
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
29 |
-
--mount=type=cache,target=/usr/local/cargo/git \
|
30 |
-
cargo build --release
|
31 |
-
|
32 |
-
# Runtime stage
|
33 |
FROM nvidia/cuda:12.2.2-runtime-ubuntu22.04 as runtime
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
# Just copy the binary from the build stage
|
39 |
-
COPY --from=builder /target/release/polyhedron /usr/local/bin/polyhedron
|
40 |
-
COPY ./models/ggml-large-encoder.mlmodelc ./models/ggml-large-encoder.mlmodelc
|
41 |
-
COPY ./models/ggml-large.bin ./models/ggml-large.bin
|
42 |
-
COPY config.yaml config.yaml
|
43 |
-
COPY ./static ./static
|
44 |
-
|
45 |
-
# Run the binary
|
46 |
-
CMD ["polyhedron"]
|
|
|
1 |
+
FROM nvidia/cuda:12.2.2-devel-ubuntu22.04 as chef
|
2 |
+
RUN apt-get update && apt-get install -y curl
|
3 |
+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
ENV PATH=/root/.cargo/bin:$PATH
|
5 |
+
RUN cargo install cargo-chef
|
6 |
+
WORKDIR /app
|
7 |
|
8 |
+
FROM chef as planner
|
9 |
+
COPY . .
|
10 |
+
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
FROM chef as builder
|
13 |
+
RUN apt-get update && apt-get install -y cmake g++ libclang-dev libssl-dev pkg-config python3-dev
|
14 |
+
COPY --from=planner /app/recipe.json recipe.json
|
15 |
+
RUN cargo chef cook --release --recipe-path recipe.json
|
16 |
+
COPY . .
|
17 |
+
RUN cargo build --release
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
FROM nvidia/cuda:12.2.2-runtime-ubuntu22.04 as runtime
|
20 |
+
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
21 |
+
WORKDIR /app
|
22 |
+
COPY --from=builder /app/target/release/polyhedron .
|
23 |
+
ENTRYPOINT ["./polyhedron"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.MD
CHANGED
@@ -22,7 +22,7 @@ Configuration like AWS credentials and models are specified in config.yaml.
|
|
22 |
To run Polyhedron locally:
|
23 |
|
24 |
1. Config AWS account via https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
|
25 |
-
2. Clone the repository, Run `
|
26 |
3. Open http://localhost:8080 in the browser
|
27 |
## Architecture
|
28 |
|
|
|
22 |
To run Polyhedron locally:
|
23 |
|
24 |
1. Config AWS account via https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
|
25 |
+
2. Clone the repository, Run `docker compose up`
|
26 |
3. Open http://localhost:8080 in the browser
|
27 |
## Architecture
|
28 |
|
docker-compose.yaml
CHANGED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: "3"
|
2 |
+
services:
|
3 |
+
polyhedron:
|
4 |
+
container_name: polyhedron
|
5 |
+
build: ./
|
6 |
+
# image: vitongue/polyhedron:latest
|
7 |
+
environment:
|
8 |
+
- AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}
|
9 |
+
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
|
10 |
+
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
|
11 |
+
- RUST_LOG=polyhedron=debug
|
12 |
+
volumes:
|
13 |
+
- ./config:/app/config
|
14 |
+
- ./static:/app/static
|
15 |
+
ports:
|
16 |
+
- "8080:8080"
|