Skip to content

Commit

Permalink
fix: k8s dockerize (#725)
Browse files Browse the repository at this point in the history
* fix: dockerfile template

* fix: docker push action
  • Loading branch information
numb3r3 authored May 23, 2022
1 parent d12c511 commit 994635f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/force-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ jobs:
fi
PIP_TAG=${{ matrix.pip_tag }}
BACKEND_TAG=torch
if [ -n "${PIP_TAG}" ]; then
PIP_TAG=-${PIP_TAG}
BACKEND_TAG=${PIP_TAG}
fi
if [[ "${{ github.event.inputs.triggered_by }}" == "CD" ]]; then
Expand Down Expand Up @@ -80,6 +82,7 @@ jobs:
fi
echo "CAS_VERSION=${CAS_VERSION}" >> $GITHUB_ENV
echo "BACKEND_TAG=${BACKEND_TAG}" >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
Expand Down Expand Up @@ -113,6 +116,7 @@ jobs:
CAS_VERSION=${{env.CAS_VERSION}}
VCS_REF=${{env.VCS_REF}}
PIP_TAG=${{matrix.pip_tag}}
BACKEND_TAG=${{env.BACKEND_TAG}}
- name: CUDA Build and push
id: cuda_docker_build
if: ${{ matrix.engine_tag == 'cuda' }}
Expand All @@ -130,3 +134,4 @@ jobs:
CAS_VERSION=${{env.CAS_VERSION}}
VCS_REF=${{env.VCS_REF}}
PIP_TAG=${{matrix.pip_tag}}
BACKEND_TAG=${{env.BACKEND_TAG}}
7 changes: 4 additions & 3 deletions Dockerfiles/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ARG JINA_VERSION=3.3.25
FROM jinaai/jina:${JINA_VERSION}-py38-standard

ARG PIP_TAG
ARG BACKEND_TAG=torch

# constant, wont invalidate cache
LABEL org.opencontainers.image.vendor="Jina AI Limited" \
Expand All @@ -19,12 +20,12 @@ RUN pip3 install --no-cache-dir torch torchvision torchaudio --extra-index-url h
# copy will almost always invalid the cache
COPY . /clip-as-service/

RUN echo '\
RUN echo "\
jtype: CLIPEncoder\n\
metas:\n\
py_modules:\n\
- server/clip_server/executors/clip_${{ env.ENGINE }}.py\n\
' > /tmp/config.yml
- server/clip_server/executors/clip_$BACKEND_TAG.py\n\
" > /tmp/config.yml

RUN cd /clip-as-service && \
if [ -n "$PIP_TAG" ]; then pip3 install --no-cache-dir server/"[$PIP_TAG]" ; fi && \
Expand Down
9 changes: 6 additions & 3 deletions Dockerfiles/cuda.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ENV DEBIAN_FRONTEND=noninteractive

ARG JINA_VERSION=3.3.25
ARG PIP_TAG
ARG BACKEND_TAG=torch

RUN apt-get update && apt-get install -y --no-install-recommends \
python3-setuptools python3-wheel python3-pip \
Expand All @@ -19,12 +20,14 @@ RUN python3 -m pip install nvidia-pyindex
COPY . /clip-as-service/


RUN echo '\
RUN echo "\
jtype: CLIPEncoder\n\
with:\n\
device: cuda\n\
metas:\n\
py_modules:\n\
- server/clip_server/executors/clip_${{ env.ENGINE }}.py\n\
' > /tmp/config.yml
- server/clip_server/executors/clip_$BACKEND_TAG.py\n\
" > /tmp/config.yml

RUN cd /clip-as-service && \
if [ -n "${PIP_TAG}" ]; then python3 -m pip install --no-cache-dir server/"[${PIP_TAG}]" ; fi && \
Expand Down

0 comments on commit 994635f

Please sign in to comment.