Skip to content

Commit

Permalink
Single application for service
Browse files Browse the repository at this point in the history
  • Loading branch information
acrrd committed Dec 18, 2023
1 parent 4f44127 commit e509964
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
4 changes: 1 addition & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,13 @@ web-dev-down:
build-service-image crate_path bin model_dir="" ort_dir="":
#!/usr/bin/env -S bash -eux -o pipefail
docker build -f "{{crate_path}}/Dockerfile" \
--target {{bin}} \
--build-arg MODEL_DIR="{{model_dir}}" \
--build-arg ORT_DIR="{{ort_dir}}" \
-t "xayn-{{crate_path}}-{{bin}}" {{justfile_directory()}}
compose-all-build model="xaynia_v0201" ort="ort_v1.15.1":
#!/usr/bin/env -S bash -eux -o pipefail
{{just_executable()}} build-service-image web-api personalization "assets/{{model}}" "assets/{{ort}}"
{{just_executable()}} build-service-image web-api ingestion "assets/{{model}}" "assets/{{ort}}"
{{just_executable()}} build-service-image web-api web-api "assets/{{model}}" "assets/{{ort}}"
compose-all-up *args:
#!/usr/bin/env -S bash -eux -o pipefail
Expand Down
14 changes: 4 additions & 10 deletions web-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ RUN --mount=type=bind,target=. cargo chef prepare --recipe-path ../recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --target-dir ../target --recipe-path recipe.json --bin ingestion && \
cargo chef cook --release --target-dir ../target --recipe-path recipe.json --bin personalization
RUN cargo chef cook --release --target-dir ../target --recipe-path recipe.json --bin web-api
# Build application
COPY . .
RUN cargo build --release --target-dir ../target --bin ingestion && \
cargo build --release --target-dir ../target --bin personalization
RUN cargo build --release --target-dir ../target --bin web-api

FROM debian:12.2-slim AS runtime
WORKDIR /app
Expand Down Expand Up @@ -46,11 +44,7 @@ RUN --mount=type=bind,target=project set -eux; \
esac; \
cp -r project/assets/"$ORT_DIR"/linux_"$ORT_ARCH"/lib/* assets/lib

FROM runtime AS ingestion
COPY --from=builder /app/target/release/ingestion server.bin
ENTRYPOINT ["/app/server.bin"]

FROM runtime AS personalization
COPY --from=builder /app/target/release/personalization server.bin
FROM runtime AS service
COPY --from=builder /app/target/release/web-api server.bin
ENTRYPOINT ["/app/server.bin"]

0 comments on commit e509964

Please sign in to comment.