Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports docker build with local .deb #1231

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/docker-nightly-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 11
- uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
- name: Build serving package for nightly
if: ${{ github.event.inputs.mode == '' || github.event.inputs.mode == 'nightly' }}
run: |
./gradlew :serving:dockerDeb -Psnapshot
- name: Build and push nightly docker image
if: ${{ github.event.inputs.mode == '' || github.event.inputs.mode == 'nightly' }}
working-directory: serving/docker
Expand Down Expand Up @@ -94,6 +107,19 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 11
- uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
- name: Build serving package for nightly
if: ${{ github.event.inputs.mode == '' || github.event.inputs.mode == 'nightly' }}
run: |
./gradlew :serving:dockerDeb -Psnapshot
- name: Build and push nightly docker image
if: ${{ github.event.inputs.mode == '' || github.event.inputs.mode == 'nightly' }}
working-directory: serving/docker
Expand Down Expand Up @@ -127,6 +153,19 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 11
- uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
- name: Build serving package for nightly
if: ${{ github.event.inputs.mode == '' || github.event.inputs.mode == 'nightly' }}
run: |
./gradlew :serving:dockerDeb -Psnapshot
- name: Build and push nightly docker image
if: ${{ github.event.inputs.mode == '' || github.event.inputs.mode == 'nightly' }}
working-directory: serving/docker
Expand Down
1 change: 1 addition & 0 deletions serving/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/plugins
/logs
docker/distributions
8 changes: 8 additions & 0 deletions serving/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ run {
clean {
delete file("plugins")
delete file("logs")
delete file("docker/distributions")
}

tasks.register('prepareDeb') {
Expand Down Expand Up @@ -98,6 +99,13 @@ tasks.register('createDeb', Deb) {
link("/usr/bin/djl-serving", "/usr/local/djl-serving-${project.version}/bin/serving")
}

tasks.register('dockerDeb', Copy) {
dependsOn createDeb
from layout.buildDirectory.dir("distributions")
include "*.deb"
into("${project.projectDir}/docker/distributions")
}

startScripts {
defaultJvmOpts = []
doLast {
Expand Down
4 changes: 4 additions & 0 deletions serving/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ COPY scripts scripts/
RUN mkdir -p /opt/djl/conf && \
mkdir -p /opt/ml/model
COPY config.properties /opt/djl/conf/

COPY distribution[s]/ ./
RUN mv *.deb djl-serving_all.deb || true

RUN scripts/install_djl_serving.sh $djl_version && \
scripts/install_s5cmd.sh x64 && \
mkdir -p /opt/djl/bin && cp scripts/telemetry.sh /opt/djl/bin && \
Expand Down
3 changes: 3 additions & 0 deletions serving/docker/aarch64.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ RUN mkdir -p /opt/djl/conf && \
mkdir -p /opt/ml/model
COPY config.properties /opt/djl/conf/

COPY distribution[s]/ ./
RUN mv *.deb djl-serving_all.deb || true

RUN scripts/install_djl_serving.sh $djl_version && \
scripts/install_djl_serving.sh $djl_version $torch_version && \
mkdir -p /opt/djl/bin && cp scripts/telemetry.sh /opt/djl/bin && \
Expand Down
3 changes: 3 additions & 0 deletions serving/docker/deepspeed.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ RUN mkdir -p /opt/djl/conf && \
COPY config.properties /opt/djl/conf/config.properties
COPY partition /opt/djl/partition

COPY distribution[s]/ ./
RUN mv *.deb djl-serving_all.deb || true

RUN apt-get update && \
scripts/install_djl_serving.sh $djl_version && \
mkdir -p /opt/djl/bin && cp scripts/telemetry.sh /opt/djl/bin && \
Expand Down
3 changes: 3 additions & 0 deletions serving/docker/fastertransformer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ RUN mkdir -p /opt/djl/conf && \
COPY config.properties /opt/djl/conf/config.properties
COPY partition /opt/djl/partition

COPY distribution[s]/ ./
RUN mv *.deb djl-serving_all.deb || true

# Install all dependencies
RUN apt-get update && apt-get install -y wget git libnuma-dev zlib1g-dev rapidjson-dev && \
mkdir ompi && cd ompi && \
Expand Down
3 changes: 3 additions & 0 deletions serving/docker/pytorch-cu118.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ ENV HUGGINGFACE_HUB_CACHE=/tmp/.cache/huggingface/hub
ENV TRANSFORMERS_CACHE=/tmp/.cache/huggingface/transformers
ENV PYTORCH_KERNEL_CACHE_PATH=/tmp/.cache

COPY distribution[s]/ ./
RUN mv *.deb djl-serving_all.deb || true

COPY scripts scripts/
RUN chmod +x /usr/local/bin/dockerd-entrypoint.sh && \
scripts/install_djl_serving.sh $djl_version && \
Expand Down
3 changes: 3 additions & 0 deletions serving/docker/pytorch-inf2.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ ENV NEURON_CC_FLAGS="--logfile /tmp/compile.log --temp-dir=/tmp"
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh"]
CMD ["serve"]

COPY distribution[s]/ ./
RUN mv *.deb djl-serving_all.deb || true

COPY scripts scripts/
RUN mkdir -p /opt/djl/conf && \
mkdir -p /opt/djl/deps && \
Expand Down
5 changes: 4 additions & 1 deletion serving/docker/scripts/install_djl_serving.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ if [ -z "$PYTORCH_JNI" ]; then
unzip

# install DJLServing
curl https://publish.djl.ai/djl-serving/djl-serving_${DJL_VERSION}-1_all.deb -f -o djl-serving_all.deb
if [ ! -f djl-serving_all.deb ]; then
curl https://publish.djl.ai/djl-serving/djl-serving_${DJL_VERSION}-1_all.deb -f -o djl-serving_all.deb
fi
dpkg -i djl-serving_all.deb
rm djl-serving_all.deb

cp /usr/local/djl-serving-*/conf/log4j2.xml /opt/djl/conf/
cp -r /usr/local/djl-serving-*/plugins /opt/djl/plugins
else
Expand Down
3 changes: 3 additions & 0 deletions serving/docker/tensorrt-llm.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ RUN mkdir -p /opt/djl/conf && \
COPY config.properties /opt/djl/conf/config.properties
COPY partition /opt/djl/partition

COPY distribution[s]/ ./
RUN mv *.deb djl-serving_all.deb || true

# Install OpenMPI and other deps
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y wget unzip openmpi-bin libopenmpi-dev libffi-dev git-lfs rapidjson-dev && \
Expand Down
Loading