Skip to content

Commit

Permalink
hotfix/fix-python-path-patching
Browse files Browse the repository at this point in the history
  • Loading branch information
DhanshreeA committed Jun 17, 2024
1 parent 626126e commit 8ef9a42
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions dockerfiles/model-deploy-v2/model/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,14 @@ COPY --from=build /root/bentoml /root/bentoml
COPY --from=build /root/docker-entrypoint.sh docker-entrypoint.sh
COPY --from=build /root/nginx.conf /etc/nginx/sites-available/default

# Writing this script here because the Dockerfile gets copied to the model directory
# and the model directory is not known until the build stage. Either we copy this script
# within the build context or we write it here.
RUN echo -e "#!/bin/bash\nset -eux\n\
cd ~/bentoml/repository/$MODEL/*/$MODEL/artifacts/\n\
if [ -f framework/run.sh ]; then\n\
sed -i -n 's/\/usr\/bin\/conda\/envs//p' framework/run.sh\n\
fi" > patch_python_path.sh && \
chmod +x patch_python_path.sh && \
./patch_python_path.sh
# Patch the python path so we call the correct python binary
RUN /bin/bash <<EOF
set -eux
cd /root/bentoml/repository/$MODEL/*/$MODEL/artifacts/
if [ -f framework/run.sh ]; then
sed -E 's/(.usr.bin.conda.envs(.*bin.*python)(.*))/\2 \3/' framework/run.sh
fi
EOF

RUN chmod + docker-entrypoint.sh
EXPOSE 80
Expand Down

0 comments on commit 8ef9a42

Please sign in to comment.