Skip to content

Commit

Permalink
feat: added docker build arguments to modal server
Browse files Browse the repository at this point in the history
  • Loading branch information
limcheekin committed Jul 13, 2024
1 parent d8b7b1a commit 4e87466
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Dockerfile-Modal
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM debian:bullseye-slim AS build-image

#ARG MODEL
#ENV MODEL=${MODEL}
ARG MODEL
ARG HOME
ENV MODEL=${MODEL}
COPY ${HOME}/download.sh ./

# Install build dependencies
Expand All @@ -15,7 +16,7 @@ RUN chmod +x *.sh && \
# Grab a fresh copy of the Python image
FROM python:3.11-slim

#ARG MODEL
ARG MODEL

RUN mkdir -p ${MODEL}
COPY --from=build-image ${MODEL} ${MODEL}
Expand Down
8 changes: 6 additions & 2 deletions open/text/embeddings/server/modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
app = App(os.environ["APP_NAME"])

image = Image.from_dockerfile(
"Dockerfile-Modal", force_build=True
"Dockerfile-Modal",
force_build=True,
build_args={
"MODEL": os.environ["MODEL"],
"HOME": os.environ["HOME"],
}
).env({
"MODEL": os.environ["MODEL"],
"NORMALIZE_EMBEDDINGS": os.environ["NORMALIZE_EMBEDDINGS"],
"VERBOSE": os.environ["VERBOSE"],
"HOME": os.environ["HOME"],
"HF_HOME": "/tmp/hf_home",
})

Expand Down

0 comments on commit 4e87466

Please sign in to comment.